-
-for ac_func in crypt fseeko getopt getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul unsetenv
+for ac_func in crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strtol strtoul unsetenv
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.344 2004/05/05 21:18:29 tgl Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.345 2004/05/07 00:24:57 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
-AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul unsetenv])
+AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strtol strtoul unsetenv])
# system's version of getaddrinfo(), if any, may be used only if we found
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
for (i = 0; i < curq->numvar; i++)
{
- cmpptr = (curvar->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+ cmpptr = (curvar->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
if (curvar->flag & LVAR_SUBLEXEM)
{
char *op = ((CHKVAL *) checkval)->operand + val->distance;
int (*cmpptr) (const char *, const char *, size_t);
- cmpptr = (val->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+ cmpptr = (val->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
while (tlen > 0)
{
if (val->flag & LVAR_SUBLEXEM)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.12 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.13 2004/05/07 00:24:57 tgl Exp $
*/
PX_MD *h;
for (p = int_digest_list; p->name; p++)
- if (!strcasecmp(p->name, name))
+ if (pg_strcasecmp(p->name, name) == 0)
{
h = px_alloc(sizeof(*h));
p->init(h);
-/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.10 2003/11/29 22:39:28 pgsql Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.11 2004/05/07 00:24:57 tgl Exp $ */
/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
/*
ctxt->md5_stb = MD5_B0;
ctxt->md5_stc = MD5_C0;
ctxt->md5_std = MD5_D0;
- bzero(ctxt->md5_buf, sizeof(ctxt->md5_buf));
+ memset(ctxt->md5_buf, 0, sizeof(ctxt->md5_buf));
}
void
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/mhash.c,v 1.9 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/mhash.c,v 1.10 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
mname = mhash_get_hash_name(i);
if (mname == NULL)
continue;
- b = strcasecmp(name, mname);
+ b = pg_strcasecmp(name, mname);
free(mname);
- if (!b)
+ if (b == 0)
{
res = i;
break;
PX_Cipher *c;
- strcpy(nbuf, name);
+ StrNCpy(nbuf, name, sizeof(nbuf));
if ((p = strrchr(nbuf, '-')) != NULL)
{
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.15 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.16 2004/05/07 00:24:57 tgl Exp $
*/
-#include <postgres.h>
-#include <fmgr.h>
+#include "postgres.h"
+
#include <ctype.h>
+#include "fmgr.h"
+#include "parser/scansup.h"
+
#include "px.h"
#include "px-crypt.h"
#include "pgcrypto.h"
char *desc, int silent)
{
void *res;
- char buf[PX_MAX_NAMELEN + 1],
- *p;
- unsigned len;
- unsigned i;
+ char *buf;
int err;
- len = VARSIZE(name) - VARHDRSZ;
- if (len > PX_MAX_NAMELEN)
- {
- if (silent)
- return NULL;
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("%s type does not exist (name too long)", desc)));
- }
-
- p = VARDATA(name);
- for (i = 0; i < len; i++)
- buf[i] = tolower((unsigned char) p[i]);
- buf[len] = 0;
+ buf = downcase_truncate_identifier(VARDATA(name),
+ VARSIZE(name) - VARHDRSZ,
+ false);
err = provider_lookup(buf, &res);
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s type does not exist: \"%s\"", desc, buf)));
+ pfree(buf);
+
return err ? NULL : res;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.7 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.8 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
for (i = 0; gen_list[i].name; i++)
{
g = &gen_list[i];
- if (strcasecmp(g->name, salt_type) != 0)
+ if (pg_strcasecmp(g->name, salt_type) != 0)
continue;
if (g->def_rounds)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.8 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.9 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
{
while (list->name)
{
- if (!strcasecmp(list->alias, name))
+ if (pg_strcasecmp(list->alias, name) == 0)
return list->name;
list++;
}
-/* $PostgreSQL: pgsql/contrib/pgcrypto/sha1.c,v 1.12 2003/11/29 22:39:28 pgsql Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/sha1.c,v 1.13 2004/05/07 00:24:57 tgl Exp $ */
/* $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $ */
/*
H(3) = H(3) + d;
H(4) = H(4) + e;
- bzero(&ctxt->m.b8[0], 64);
+ memset(&ctxt->m.b8[0], 0, 64);
}
/*------------------------------------------------------------*/
void
sha1_init(struct sha1_ctxt * ctxt)
{
- bzero(ctxt, sizeof(struct sha1_ctxt));
+ memset(ctxt, 0, sizeof(struct sha1_ctxt));
H(0) = 0x67452301;
H(1) = 0xefcdab89;
H(2) = 0x98badcfe;
padlen = 64 - padstart;
if (padlen < 8)
{
- bzero(&ctxt->m.b8[padstart], padlen);
+ memset(&ctxt->m.b8[padstart], 0, padlen);
COUNT += padlen;
COUNT %= 64;
sha1_step(ctxt);
padstart = COUNT % 64; /* should be 0 */
padlen = 64 - padstart; /* should be 64 */
}
- bzero(&ctxt->m.b8[padstart], padlen - 8);
+ memset(&ctxt->m.b8[padstart], 0, padlen - 8);
COUNT += (padlen - 8);
COUNT %= 64;
#if BYTE_ORDER == BIG_ENDIAN
TTOffList *pp;
for (pp = TTOff.next; pp; pp = pp->next)
- if (strcasecmp(name, pp->name) == 0)
+ if (pg_strcasecmp(name, pp->name) == 0)
return 0;
return 1;
}
pcfg = cfg;
while (pcfg->key)
{
- if (strcasecmp("DictFile", pcfg->key) == 0)
+ if (pg_strcasecmp("DictFile", pcfg->key) == 0)
{
if (dictloaded)
{
}
dictloaded = true;
}
- else if (strcasecmp("AffFile", pcfg->key) == 0)
+ else if (pg_strcasecmp("AffFile", pcfg->key) == 0)
{
if (affloaded)
{
}
affloaded = true;
}
- else if (strcasecmp("StopFile", pcfg->key) == 0)
+ else if (pg_strcasecmp("StopFile", pcfg->key) == 0)
{
text *tmp = char2text(pcfg->value);
#define MAX_NORM 1024
#define MAXNORMLEN 256
-#define STRNCASECMP(x,y) (strncasecmp(x,y,strlen(y)))
+#define STRNCASECMP(x,y) pg_strncasecmp(x, y, strlen(y))
#define GETWCHAR(W,L,N,T) ( ((uint8*)(W))[ ((T)=='p') ? (N) : ( (L) - 1 - (N) ) ] )
#define GETCHAR(A,N,T) GETWCHAR( (A)->repl, (A)->replen, N, T )
continue;
}
}
- if (!STRNCASECMP(str, "suffixes"))
+ if (STRNCASECMP(str, "suffixes")==0)
{
suffixes = 1;
prefixes = 0;
continue;
}
- if (!STRNCASECMP(str, "prefixes"))
+ if (STRNCASECMP(str, "prefixes")==0)
{
suffixes = 0;
prefixes = 1;
continue;
}
- if (!STRNCASECMP(str, "flag "))
+ if (STRNCASECMP(str, "flag ")==0)
{
s = str + 5;
flagflags=0;
while (mptr && mptr->key)
{
- if (strcasecmp(mptr->key, "MaxWords") == 0)
+ if (pg_strcasecmp(mptr->key, "MaxWords") == 0)
max_words = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "MinWords") == 0)
+ else if (pg_strcasecmp(mptr->key, "MinWords") == 0)
min_words = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "ShortWord") == 0)
+ else if (pg_strcasecmp(mptr->key, "ShortWord") == 0)
shortword = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "StartSel") == 0)
+ else if (pg_strcasecmp(mptr->key, "StartSel") == 0)
prs->startsel = pstrdup(mptr->value);
- else if (strcasecmp(mptr->key, "StopSel") == 0)
+ else if (pg_strcasecmp(mptr->key, "StopSel") == 0)
prs->stopsel = pstrdup(mptr->value);
pfree(mptr->key);
# -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.180 2004/04/30 15:01:25 momjian Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.181 2004/05/07 00:24:57 tgl Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
#
# substitute implementations of the C library
-LIBOBJS = @LIBOBJS@ noblock.o path.o pgsleep.o sprompt.o thread.o
+LIBOBJS = @LIBOBJS@ noblock.o path.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
ifneq (,$(LIBOBJS))
LIBS += -lpgport
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.139 2004/04/19 17:42:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.140 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int new_sync_method;
int new_sync_bit;
- if (strcasecmp(method, "fsync") == 0)
+ if (pg_strcasecmp(method, "fsync") == 0)
{
new_sync_method = SYNC_METHOD_FSYNC;
new_sync_bit = 0;
}
#ifdef HAVE_FDATASYNC
- else if (strcasecmp(method, "fdatasync") == 0)
+ else if (pg_strcasecmp(method, "fdatasync") == 0)
{
new_sync_method = SYNC_METHOD_FDATASYNC;
new_sync_bit = 0;
}
#endif
#ifdef OPEN_SYNC_FLAG
- else if (strcasecmp(method, "open_sync") == 0)
+ else if (pg_strcasecmp(method, "open_sync") == 0)
{
new_sync_method = SYNC_METHOD_OPEN;
new_sync_bit = OPEN_SYNC_FLAG;
}
#endif
#ifdef OPEN_DATASYNC_FLAG
- else if (strcasecmp(method, "open_datasync") == 0)
+ else if (pg_strcasecmp(method, "open_datasync") == 0)
{
new_sync_method = SYNC_METHOD_OPEN;
new_sync_bit = OPEN_DATASYNC_FLAG;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.16 2003/11/29 19:51:47 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.17 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
* sfunc1, stype1, and initcond1 are accepted as obsolete
* spellings for sfunc, stype, initcond.
*/
- if (strcasecmp(defel->defname, "sfunc") == 0)
+ if (pg_strcasecmp(defel->defname, "sfunc") == 0)
transfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "sfunc1") == 0)
+ else if (pg_strcasecmp(defel->defname, "sfunc1") == 0)
transfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "finalfunc") == 0)
+ else if (pg_strcasecmp(defel->defname, "finalfunc") == 0)
finalfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "basetype") == 0)
+ else if (pg_strcasecmp(defel->defname, "basetype") == 0)
baseType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "stype") == 0)
+ else if (pg_strcasecmp(defel->defname, "stype") == 0)
transType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "stype1") == 0)
+ else if (pg_strcasecmp(defel->defname, "stype1") == 0)
transType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "initcond") == 0)
+ else if (pg_strcasecmp(defel->defname, "initcond") == 0)
initval = defGetString(defel);
- else if (strcasecmp(defel->defname, "initcond1") == 0)
+ else if (pg_strcasecmp(defel->defname, "initcond1") == 0)
initval = defGetString(defel);
else
ereport(WARNING,
* be able to store values of the transtype. However, we can allow
* polymorphic transtype in some cases (AggregateCreate will check).
*/
- if (strcasecmp(TypeNameToString(baseType), "ANY") == 0)
+ if (pg_strcasecmp(TypeNameToString(baseType), "ANY") == 0)
baseTypeId = ANYOID;
else
baseTypeId = typenameTypeId(baseType);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.86 2004/02/21 00:34:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.87 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
def->defname)));
break;
case T_String:
- if (strcasecmp(strVal(def->arg), "variable") == 0)
+ 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 (strcasecmp(TypeNameToString((TypeName *) def->arg),
+ if (pg_strcasecmp(TypeNameToString((TypeName *) def->arg),
"variable") == 0)
return -1; /* variable length */
break;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.44 2004/02/21 00:34:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.45 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
{
DefElem *param = (DefElem *) lfirst(pl);
- if (strcasecmp(param->defname, "isstrict") == 0)
+ if (pg_strcasecmp(param->defname, "isstrict") == 0)
*isStrict_p = true;
- else if (strcasecmp(param->defname, "iscachable") == 0)
+ else if (pg_strcasecmp(param->defname, "iscachable") == 0)
{
/* obsolete spelling of isImmutable */
*volatility_p = PROVOLATILE_IMMUTABLE;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.13 2003/11/29 19:51:47 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.14 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
{
DefElem *defel = (DefElem *) lfirst(pl);
- if (strcasecmp(defel->defname, "leftarg") == 0)
+ if (pg_strcasecmp(defel->defname, "leftarg") == 0)
{
typeName1 = defGetTypeName(defel);
if (typeName1->setof)
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("setof type not allowed for operator argument")));
}
- else if (strcasecmp(defel->defname, "rightarg") == 0)
+ else if (pg_strcasecmp(defel->defname, "rightarg") == 0)
{
typeName2 = defGetTypeName(defel);
if (typeName2->setof)
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("setof type not allowed for operator argument")));
}
- else if (strcasecmp(defel->defname, "procedure") == 0)
+ else if (pg_strcasecmp(defel->defname, "procedure") == 0)
functionName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "commutator") == 0)
+ else if (pg_strcasecmp(defel->defname, "commutator") == 0)
commutatorName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "negator") == 0)
+ else if (pg_strcasecmp(defel->defname, "negator") == 0)
negatorName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "restrict") == 0)
+ else if (pg_strcasecmp(defel->defname, "restrict") == 0)
restrictionName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "join") == 0)
+ else if (pg_strcasecmp(defel->defname, "join") == 0)
joinName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "hashes") == 0)
+ else if (pg_strcasecmp(defel->defname, "hashes") == 0)
canHash = TRUE;
- else if (strcasecmp(defel->defname, "merges") == 0)
+ else if (pg_strcasecmp(defel->defname, "merges") == 0)
canMerge = TRUE;
- else if (strcasecmp(defel->defname, "sort1") == 0)
+ else if (pg_strcasecmp(defel->defname, "sort1") == 0)
leftSortName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "sort2") == 0)
+ else if (pg_strcasecmp(defel->defname, "sort2") == 0)
rightSortName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "ltcmp") == 0)
+ else if (pg_strcasecmp(defel->defname, "ltcmp") == 0)
ltCompareName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "gtcmp") == 0)
+ else if (pg_strcasecmp(defel->defname, "gtcmp") == 0)
gtCompareName = defGetQualifiedName(defel);
else
ereport(WARNING,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.104 2004/05/06 16:10:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.105 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Assert(IsA(newValue, String));
storagemode = strVal(newValue);
- if (strcasecmp(storagemode, "plain") == 0)
+ if (pg_strcasecmp(storagemode, "plain") == 0)
newstorage = 'p';
- else if (strcasecmp(storagemode, "external") == 0)
+ else if (pg_strcasecmp(storagemode, "external") == 0)
newstorage = 'e';
- else if (strcasecmp(storagemode, "extended") == 0)
+ else if (pg_strcasecmp(storagemode, "extended") == 0)
newstorage = 'x';
- else if (strcasecmp(storagemode, "main") == 0)
+ else if (pg_strcasecmp(storagemode, "main") == 0)
newstorage = 'm';
else
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.54 2004/05/05 17:06:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.55 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
{
DefElem *defel = (DefElem *) lfirst(pl);
- if (strcasecmp(defel->defname, "internallength") == 0)
+ if (pg_strcasecmp(defel->defname, "internallength") == 0)
internalLength = defGetTypeLength(defel);
- else if (strcasecmp(defel->defname, "externallength") == 0)
+ else if (pg_strcasecmp(defel->defname, "externallength") == 0)
; /* ignored -- remove after 7.3 */
- else if (strcasecmp(defel->defname, "input") == 0)
+ else if (pg_strcasecmp(defel->defname, "input") == 0)
inputName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "output") == 0)
+ else if (pg_strcasecmp(defel->defname, "output") == 0)
outputName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "receive") == 0)
+ else if (pg_strcasecmp(defel->defname, "receive") == 0)
receiveName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "send") == 0)
+ else if (pg_strcasecmp(defel->defname, "send") == 0)
sendName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "analyze") == 0 ||
- strcasecmp(defel->defname, "analyse") == 0)
+ else if (pg_strcasecmp(defel->defname, "analyze") == 0 ||
+ pg_strcasecmp(defel->defname, "analyse") == 0)
analyzeName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "delimiter") == 0)
+ else if (pg_strcasecmp(defel->defname, "delimiter") == 0)
{
char *p = defGetString(defel);
delimiter = p[0];
}
- else if (strcasecmp(defel->defname, "element") == 0)
+ else if (pg_strcasecmp(defel->defname, "element") == 0)
{
elemType = typenameTypeId(defGetTypeName(defel));
/* disallow arrays of pseudotypes */
errmsg("array element type cannot be %s",
format_type_be(elemType))));
}
- else if (strcasecmp(defel->defname, "default") == 0)
+ else if (pg_strcasecmp(defel->defname, "default") == 0)
defaultValue = defGetString(defel);
- else if (strcasecmp(defel->defname, "passedbyvalue") == 0)
+ else if (pg_strcasecmp(defel->defname, "passedbyvalue") == 0)
byValue = true;
- else if (strcasecmp(defel->defname, "alignment") == 0)
+ else if (pg_strcasecmp(defel->defname, "alignment") == 0)
{
char *a = defGetString(defel);
* recognize translated type names as well as the nominal
* form.
*/
- if (strcasecmp(a, "double") == 0 ||
- strcasecmp(a, "float8") == 0 ||
- strcasecmp(a, "pg_catalog.float8") == 0)
+ if (pg_strcasecmp(a, "double") == 0 ||
+ pg_strcasecmp(a, "float8") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.float8") == 0)
alignment = 'd';
- else if (strcasecmp(a, "int4") == 0 ||
- strcasecmp(a, "pg_catalog.int4") == 0)
+ else if (pg_strcasecmp(a, "int4") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.int4") == 0)
alignment = 'i';
- else if (strcasecmp(a, "int2") == 0 ||
- strcasecmp(a, "pg_catalog.int2") == 0)
+ else if (pg_strcasecmp(a, "int2") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.int2") == 0)
alignment = 's';
- else if (strcasecmp(a, "char") == 0 ||
- strcasecmp(a, "pg_catalog.bpchar") == 0)
+ else if (pg_strcasecmp(a, "char") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.bpchar") == 0)
alignment = 'c';
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("alignment \"%s\" not recognized", a)));
}
- else if (strcasecmp(defel->defname, "storage") == 0)
+ else if (pg_strcasecmp(defel->defname, "storage") == 0)
{
char *a = defGetString(defel);
- if (strcasecmp(a, "plain") == 0)
+ if (pg_strcasecmp(a, "plain") == 0)
storage = 'p';
- else if (strcasecmp(a, "external") == 0)
+ else if (pg_strcasecmp(a, "external") == 0)
storage = 'e';
- else if (strcasecmp(a, "extended") == 0)
+ else if (pg_strcasecmp(a, "extended") == 0)
storage = 'x';
- else if (strcasecmp(a, "main") == 0)
+ else if (pg_strcasecmp(a, "main") == 0)
storage = 'm';
else
ereport(ERROR,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.93 2004/01/19 19:04:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.94 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_shadow.h"
#include "commands/variable.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/syscache.h"
/* Ugh. Somebody ought to write a table driven version -- mjl */
- if (strcasecmp(tok, "ISO") == 0)
+ if (pg_strcasecmp(tok, "ISO") == 0)
{
newDateStyle = USE_ISO_DATES;
scnt++;
}
- else if (strcasecmp(tok, "SQL") == 0)
+ else if (pg_strcasecmp(tok, "SQL") == 0)
{
newDateStyle = USE_SQL_DATES;
scnt++;
}
- else if (strncasecmp(tok, "POSTGRES", 8) == 0)
+ else if (pg_strncasecmp(tok, "POSTGRES", 8) == 0)
{
newDateStyle = USE_POSTGRES_DATES;
scnt++;
}
- else if (strcasecmp(tok, "GERMAN") == 0)
+ else if (pg_strcasecmp(tok, "GERMAN") == 0)
{
newDateStyle = USE_GERMAN_DATES;
scnt++;
if (ocnt == 0)
newDateOrder = DATEORDER_DMY;
}
- else if (strcasecmp(tok, "YMD") == 0)
+ else if (pg_strcasecmp(tok, "YMD") == 0)
{
newDateOrder = DATEORDER_YMD;
ocnt++;
}
- else if (strcasecmp(tok, "DMY") == 0 ||
- strncasecmp(tok, "EURO", 4) == 0)
+ else if (pg_strcasecmp(tok, "DMY") == 0 ||
+ pg_strncasecmp(tok, "EURO", 4) == 0)
{
newDateOrder = DATEORDER_DMY;
ocnt++;
}
- else if (strcasecmp(tok, "MDY") == 0 ||
- strcasecmp(tok, "US") == 0 ||
- strncasecmp(tok, "NONEURO", 7) == 0)
+ else if (pg_strcasecmp(tok, "MDY") == 0 ||
+ pg_strcasecmp(tok, "US") == 0 ||
+ pg_strncasecmp(tok, "NONEURO", 7) == 0)
{
newDateOrder = DATEORDER_MDY;
ocnt++;
}
- else if (strcasecmp(tok, "DEFAULT") == 0)
+ else if (pg_strcasecmp(tok, "DEFAULT") == 0)
{
/*
* Easiest way to get the current DEFAULT state is to fetch
static bool
tzset_succeeded(const char *tz)
{
- char tztmp[TZBUF_LEN];
- char *cp;
+ char *tztmp;
int tzval;
/*
* Check for known spellings of "UTC". Note we must downcase the
* input before passing it to DecodePosixTimezone().
*/
- StrNCpy(tztmp, tz, sizeof(tztmp));
- for (cp = tztmp; *cp; cp++)
- *cp = tolower((unsigned char) *cp);
+ tztmp = downcase_truncate_identifier(tz, strlen(tz), false);
if (DecodePosixTimezone(tztmp, &tzval) == 0)
if (tzval == 0)
return true;
/*
* Check for INTERVAL 'foo'
*/
- if (strncasecmp(value, "interval", 8) == 0)
+ if (pg_strncasecmp(value, "interval", 8) == 0)
{
const char *valueptr = value;
char *val;
HasCTZSet = true;
}
}
- else if (strcasecmp(value, "UNKNOWN") == 0)
+ else if (pg_strcasecmp(value, "UNKNOWN") == 0)
{
/*
* UNKNOWN is the value shown as the "default" for TimeZone in
* permission to use and distribute the software in accordance with the
* terms specified in this license.
*
- * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.5 2003/11/29 19:51:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.6 2004/05/07 00:24:57 tgl Exp $
*/
/* ASCII character-name table */
* some ctype functions with non-ascii-char guard
*/
static int
-pg_isdigit(pg_wchar c)
+pg_wc_isdigit(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c));
}
static int
-pg_isalpha(pg_wchar c)
+pg_wc_isalpha(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c));
}
static int
-pg_isalnum(pg_wchar c)
+pg_wc_isalnum(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char) c));
}
static int
-pg_isupper(pg_wchar c)
+pg_wc_isupper(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c));
}
static int
-pg_islower(pg_wchar c)
+pg_wc_islower(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c));
}
static int
-pg_isgraph(pg_wchar c)
+pg_wc_isgraph(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
}
static int
-pg_isprint(pg_wchar c)
+pg_wc_isprint(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
}
static int
-pg_ispunct(pg_wchar c)
+pg_wc_ispunct(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char) c));
}
static int
-pg_isspace(pg_wchar c)
+pg_wc_isspace(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isspace((unsigned char) c));
}
static pg_wchar
-pg_toupper(pg_wchar c)
+pg_wc_toupper(pg_wchar c)
{
if (c >= 0 && c <= UCHAR_MAX)
return toupper((unsigned char) c);
}
static pg_wchar
-pg_tolower(pg_wchar c)
+pg_wc_tolower(pg_wchar c)
{
if (c >= 0 && c <= UCHAR_MAX)
return tolower((unsigned char) c);
for (c = a; c <= b; c++)
{
addchr(cv, c);
- lc = pg_tolower((chr) c);
+ lc = pg_wc_tolower((chr) c);
if (c != lc)
addchr(cv, lc);
- uc = pg_toupper((chr) c);
+ uc = pg_wc_toupper((chr) c);
if (c != uc)
addchr(cv, uc);
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isprint((chr) i))
+ if (pg_wc_isprint((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isalnum((chr) i))
+ if (pg_wc_isalnum((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isalpha((chr) i))
+ if (pg_wc_isalpha((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_ispunct((chr) i))
+ if (pg_wc_ispunct((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isspace((chr) i))
+ if (pg_wc_isspace((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_islower((chr) i))
+ if (pg_wc_islower((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isupper((chr) i))
+ if (pg_wc_isupper((chr) i))
addchr(cv, (chr) i);
}
}
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isgraph((chr) i))
+ if (pg_wc_isgraph((chr) i))
addchr(cv, (chr) i);
}
}
chr lc,
uc;
- lc = pg_tolower((chr) c);
- uc = pg_toupper((chr) c);
+ lc = pg_wc_tolower((chr) c);
+ uc = pg_wc_toupper((chr) c);
cv = getcvec(v, 2, 0, 0);
addchr(cv, lc);
{
for (; len > 0; len--, x++, y++)
{
- if ((*x != *y) && (pg_tolower(*x) != pg_tolower(*y)))
+ if ((*x != *y) && (pg_wc_tolower(*x) != pg_wc_tolower(*y)))
return 1;
}
return 0;
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.40 2003/11/29 19:51:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.41 2004/05/07 00:24:57 tgl Exp $
*
*/
static void freecvec(struct cvec *);
/* === regc_locale.c === */
-static int pg_isdigit(pg_wchar c);
-static int pg_isalpha(pg_wchar c);
-static int pg_isalnum(pg_wchar c);
-static int pg_isupper(pg_wchar c);
-static int pg_islower(pg_wchar c);
-static int pg_isgraph(pg_wchar c);
-static int pg_isprint(pg_wchar c);
-static int pg_ispunct(pg_wchar c);
-static int pg_isspace(pg_wchar c);
-static pg_wchar pg_toupper(pg_wchar c);
-static pg_wchar pg_tolower(pg_wchar c);
+static int pg_wc_isdigit(pg_wchar c);
+static int pg_wc_isalpha(pg_wchar c);
+static int pg_wc_isalnum(pg_wchar c);
+static int pg_wc_isupper(pg_wchar c);
+static int pg_wc_islower(pg_wchar c);
+static int pg_wc_isgraph(pg_wchar c);
+static int pg_wc_isprint(pg_wchar c);
+static int pg_wc_ispunct(pg_wchar c);
+static int pg_wc_isspace(pg_wchar c);
+static pg_wchar pg_wc_toupper(pg_wchar c);
+static pg_wchar pg_wc_tolower(pg_wchar c);
static int nmcces(struct vars *);
static int nleaders(struct vars *);
static struct cvec *allmcces(struct vars *, struct cvec *);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.103 2004/05/02 13:38:27 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.104 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
priv_type = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(priv_type_text)));
- if (strcasecmp(priv_type, "SELECT") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT") == 0)
return ACL_SELECT;
- if (strcasecmp(priv_type, "INSERT") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT") == 0)
return ACL_INSERT;
- if (strcasecmp(priv_type, "UPDATE") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE") == 0)
return ACL_UPDATE;
- if (strcasecmp(priv_type, "DELETE") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE") == 0)
return ACL_DELETE;
- if (strcasecmp(priv_type, "RULE") == 0)
+ if (pg_strcasecmp(priv_type, "RULE") == 0)
return ACL_RULE;
- if (strcasecmp(priv_type, "REFERENCES") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES") == 0)
return ACL_REFERENCES;
- if (strcasecmp(priv_type, "TRIGGER") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER") == 0)
return ACL_TRIGGER;
- if (strcasecmp(priv_type, "EXECUTE") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE") == 0)
return ACL_EXECUTE;
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "TEMP") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMPORARY") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY") == 0)
return ACL_CREATE_TEMP;
ereport(ERROR,
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "SELECT") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT") == 0)
return ACL_SELECT;
- if (strcasecmp(priv_type, "SELECT WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_SELECT);
- if (strcasecmp(priv_type, "INSERT") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT") == 0)
return ACL_INSERT;
- if (strcasecmp(priv_type, "INSERT WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_INSERT);
- if (strcasecmp(priv_type, "UPDATE") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE") == 0)
return ACL_UPDATE;
- if (strcasecmp(priv_type, "UPDATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_UPDATE);
- if (strcasecmp(priv_type, "DELETE") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE") == 0)
return ACL_DELETE;
- if (strcasecmp(priv_type, "DELETE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_DELETE);
- if (strcasecmp(priv_type, "RULE") == 0)
+ if (pg_strcasecmp(priv_type, "RULE") == 0)
return ACL_RULE;
- if (strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_RULE);
- if (strcasecmp(priv_type, "REFERENCES") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES") == 0)
return ACL_REFERENCES;
- if (strcasecmp(priv_type, "REFERENCES WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_REFERENCES);
- if (strcasecmp(priv_type, "TRIGGER") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER") == 0)
return ACL_TRIGGER;
- if (strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_TRIGGER);
ereport(ERROR,
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE);
- if (strcasecmp(priv_type, "TEMPORARY") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMPORARY WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP);
- if (strcasecmp(priv_type, "TEMP") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMP WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP);
ereport(ERROR,
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "EXECUTE") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE") == 0)
return ACL_EXECUTE;
- if (strcasecmp(priv_type, "EXECUTE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_EXECUTE);
ereport(ERROR,
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_USAGE);
ereport(ERROR,
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE);
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_USAGE);
ereport(ERROR,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.31 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.32 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
case 't':
case 'T':
- if (strncasecmp(b, "true", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "true", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case 'f':
case 'F':
- if (strncasecmp(b, "false", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "false", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
case 'y':
case 'Y':
- if (strncasecmp(b, "yes", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "yes", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case '1':
- if (strncasecmp(b, "1", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "1", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case 'n':
case 'N':
- if (strncasecmp(b, "no", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "no", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
case '0':
- if (strncasecmp(b, "0", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "0", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.62 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.63 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres.h"
strcat(buf, m0 == 1 ? " cent" : " cents");
/* capitalize output */
- buf[0] = toupper((unsigned char) buf[0]);
+ buf[0] = pg_toupper((unsigned char) buf[0]);
/* make a text type for output */
result = (text *) palloc(strlen(buf) + VARHDRSZ);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.95 2004/02/14 20:16:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.96 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "access/hash.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/nabstime.h"
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
-
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("\"time\" units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ char *lowunits;
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
-
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("\"time with time zone\" units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ char *lowunits;
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
+ char *lowzone;
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
type = DecodeSpecial(0, lowzone, &val);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.126 2004/03/30 15:53:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.127 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
ftype[nf] = DTK_DATE;
while (isalnum((unsigned char) *cp) || (*cp == delim))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
}
}
else if (isalpha((unsigned char) *cp))
{
ftype[nf] = DTK_STRING;
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
while (isalpha((unsigned char) *cp))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
/*
* Full date string with leading text month? Could also be a
else if (isalpha((unsigned char) *cp))
{
ftype[nf] = DTK_SPECIAL;
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
while (isalpha((unsigned char) *cp))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
}
/* otherwise something wrong... */
else
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.10 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.11 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int i;
for (i = 0; enclist[i].name; i++)
- if (strcasecmp(enclist[i].name, name) == 0)
+ if (pg_strcasecmp(enclist[i].name, name) == 0)
return &enclist[i].enc;
return NULL;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.103 2004/04/01 23:52:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.104 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* set ERANGE anyway...) Therefore, we check for these inputs
* ourselves.
*/
- if (strncasecmp(num, "NaN", 3) == 0)
+ if (pg_strncasecmp(num, "NaN", 3) == 0)
{
val = get_float4_nan();
endptr = num + 3;
}
- else if (strncasecmp(num, "Infinity", 8) == 0)
+ else if (pg_strncasecmp(num, "Infinity", 8) == 0)
{
val = get_float4_infinity();
endptr = num + 8;
}
- else if (strncasecmp(num, "-Infinity", 9) == 0)
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
{
val = - get_float4_infinity();
endptr = num + 9;
* set ERANGE anyway...) Therefore, we check for these inputs
* ourselves.
*/
- if (strncasecmp(num, "NaN", 3) == 0)
+ if (pg_strncasecmp(num, "NaN", 3) == 0)
{
val = get_float8_nan();
endptr = num + 3;
}
- else if (strncasecmp(num, "Infinity", 8) == 0)
+ else if (pg_strncasecmp(num, "Infinity", 8) == 0)
{
val = get_float8_infinity();
endptr = num + 8;
}
- else if (strncasecmp(num, "-Infinity", 9) == 0)
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
{
val = - get_float8_infinity();
endptr = num + 9;
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.73 2004/03/30 15:53:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.74 2004/05/07 00:24:58 tgl Exp $
*
*
* Portions Copyright (c) 1999-2003, PostgreSQL Global Development Group
while (*p_buff)
{
- *p_buff = toupper((unsigned char) *p_buff);
+ *p_buff = pg_toupper((unsigned char) *p_buff);
++p_buff;
}
return buff;
while (*p_buff)
{
- *p_buff = tolower((unsigned char) *p_buff);
+ *p_buff = pg_tolower((unsigned char) *p_buff);
++p_buff;
}
return buff;
/* set first char */
if (type == ONE_UPPER || type == ALL_UPPER)
- *name = toupper((unsigned char) *name);
+ *name = pg_toupper((unsigned char) *name);
else if (type == ALL_LOWER)
- *name = tolower((unsigned char) *name);
+ *name = pg_tolower((unsigned char) *name);
for (last = 0, a = array; *a != NULL; a++)
{
if (i > last)
{
if (type == ONE_UPPER || type == ALL_LOWER)
- *n = tolower((unsigned char) *n);
+ *n = pg_tolower((unsigned char) *n);
else if (type == ALL_UPPER)
- *n = toupper((unsigned char) *n);
+ *n = pg_toupper((unsigned char) *n);
last = i;
}
case DCH_month:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
if (S_FM(suf))
return strlen(p_inout) - 1;
else
case DCH_mon:
strcpy(inout, months[tm->tm_mon - 1]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
return 2;
case DCH_MM:
case DCH_day:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, days[tm->tm_wday]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
if (S_FM(suf))
return strlen(p_inout) - 1;
else
case DCH_dy:
strcpy(inout, days[tm->tm_wday]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
return 2;
case DCH_DDD:
* Copyright (c) 1998-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.72 2004/03/15 03:29:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.73 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Check for NaN
*/
- if (strcasecmp(str, "NaN") == 0)
+ if (pg_strcasecmp(str, "NaN") == 0)
PG_RETURN_NUMERIC(make_result(&const_nan));
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.52 2004/02/03 17:52:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.53 2004/05/07 00:24:58 tgl Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
assign_regex_flavor(const char *value,
bool doit, GucSource source)
{
- if (strcasecmp(value, "advanced") == 0)
+ if (pg_strcasecmp(value, "advanced") == 0)
{
if (doit)
regex_flavor = REG_ADVANCED;
}
- else if (strcasecmp(value, "extended") == 0)
+ else if (pg_strcasecmp(value, "extended") == 0)
{
if (doit)
regex_flavor = REG_EXTENDED;
}
- else if (strcasecmp(value, "basic") == 0)
+ else if (pg_strcasecmp(value, "basic") == 0)
{
if (doit)
regex_flavor = REG_BASIC;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.86 2004/01/31 05:09:40 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.87 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*ptr2 = '\0';
}
- if (allowNone && strcasecmp(typename, "none") == 0)
+ if (allowNone && pg_strcasecmp(typename, "none") == 0)
{
/* Special case for NONE */
typeid = InvalidOid;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.42 2003/11/29 19:51:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.43 2004/05/07 00:24:58 tgl Exp $
*
* NOTES
* input routine largely stolen from boxin().
for (i = 0; i < natts; i++)
{
- if (strcasecmp(NameStr(att->attrs[i]->attname), "ctid") == 0)
+ if (strcmp(NameStr(att->attrs[i]->attname), "ctid") == 0)
{
if (att->attrs[i]->atttypid != TIDOID)
elog(ERROR, "ctid isn't of type TID");
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.104 2004/04/10 18:02:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/array.h"
#include "utils/builtins.h"
Timestamp result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ if (TIMESTAMP_NOT_FINITE(timestamp))
+ PG_RETURN_TIMESTAMP(timestamp);
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
- if (TIMESTAMP_NOT_FINITE(timestamp))
- PG_RETURN_TIMESTAMP(timestamp);
-
if (type == UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
char *tzn;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp with time zone units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_TIMESTAMPTZ(timestamp);
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
Interval *result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
result = (Interval *) palloc(sizeof(Interval));
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
- type = DecodeSpecial(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
{
result = 0;
PG_RETURN_FLOAT8(result);
}
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+ if (type == UNKNOWN_FIELD)
+ type = DecodeSpecial(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
double dummy;
fsec_t fsec;
char *tzn;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp with time zone units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
- type = DecodeSpecial(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
{
result = 0;
PG_RETURN_FLOAT8(result);
}
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+ if (type == UNKNOWN_FIELD)
+ type = DecodeSpecial(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
+ char *lowzone;
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_TIMESTAMPTZ(timestamp);
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
type = DecodeSpecial(0, lowzone, &val);
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeSpecial(0, lowzone, &val);
+ char *lowzone;
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_NULL();
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
+
+ type = DecodeSpecial(0, lowzone, &val);
+
if ((type == TZ) || (type == DTZ))
{
tz = val * 60;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.135 2004/04/22 03:51:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.136 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (!openlog_done)
{
- if (strcasecmp(Syslog_facility, "LOCAL0") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL0") == 0)
syslog_fac = LOG_LOCAL0;
- if (strcasecmp(Syslog_facility, "LOCAL1") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL1") == 0)
syslog_fac = LOG_LOCAL1;
- if (strcasecmp(Syslog_facility, "LOCAL2") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL2") == 0)
syslog_fac = LOG_LOCAL2;
- if (strcasecmp(Syslog_facility, "LOCAL3") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL3") == 0)
syslog_fac = LOG_LOCAL3;
- if (strcasecmp(Syslog_facility, "LOCAL4") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL4") == 0)
syslog_fac = LOG_LOCAL4;
- if (strcasecmp(Syslog_facility, "LOCAL5") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL5") == 0)
syslog_fac = LOG_LOCAL5;
- if (strcasecmp(Syslog_facility, "LOCAL6") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL6") == 0)
syslog_fac = LOG_LOCAL6;
- if (strcasecmp(Syslog_facility, "LOCAL7") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL7") == 0)
syslog_fac = LOG_LOCAL7;
openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.201 2004/04/19 21:22:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.202 2004/05/07 00:24:58 tgl Exp $
*
*--------------------------------------------------------------------
*/
{
size_t len = strlen(value);
- if (strncasecmp(value, "true", len) == 0)
+ if (pg_strncasecmp(value, "true", len) == 0)
{
if (result)
*result = true;
}
- else if (strncasecmp(value, "false", len) == 0)
+ else if (pg_strncasecmp(value, "false", len) == 0)
{
if (result)
*result = false;
}
- else if (strncasecmp(value, "yes", len) == 0)
+ else if (pg_strncasecmp(value, "yes", len) == 0)
{
if (result)
*result = true;
}
- else if (strncasecmp(value, "no", len) == 0)
+ else if (pg_strncasecmp(value, "no", len) == 0)
{
if (result)
*result = false;
}
- else if (strcasecmp(value, "on") == 0)
+ else if (pg_strcasecmp(value, "on") == 0)
{
if (result)
*result = true;
}
- else if (strcasecmp(value, "off") == 0)
+ else if (pg_strcasecmp(value, "off") == 0)
{
if (result)
*result = false;
}
- else if (strcasecmp(value, "1") == 0)
+ else if (pg_strcasecmp(value, "1") == 0)
{
if (result)
*result = true;
}
- else if (strcasecmp(value, "0") == 0)
+ else if (pg_strcasecmp(value, "0") == 0)
{
if (result)
*result = false;
void
GetPGVariable(const char *name, DestReceiver *dest)
{
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
ShowAllGUCConfig(dest);
else
ShowGUCConfigOption(name, dest);
{
TupleDesc tupdesc;
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
{
/* need a tuple descriptor representing two TEXT columns */
tupdesc = CreateTemplateTupleDesc(2, false);
void
ResetPGVariable(const char *name)
{
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
ResetAllOptions();
else
set_config_option(name,
{
char *tok = (char *) lfirst(l);
- if (strcasecmp(tok,"stderr") == 0)
+ if (pg_strcasecmp(tok,"stderr") == 0)
newlogdest |= LOG_DESTINATION_STDERR;
#ifdef HAVE_SYSLOG
- else if (strcasecmp(tok,"syslog") == 0)
+ else if (pg_strcasecmp(tok,"syslog") == 0)
newlogdest |= LOG_DESTINATION_SYSLOG;
#endif
#ifdef WIN32
- else if (strcasecmp(tok,"eventlog") == 0)
+ else if (pg_strcasecmp(tok,"eventlog") == 0)
newlogdest |= LOG_DESTINATION_EVENTLOG;
#endif
else {
static const char *
assign_facility(const char *facility, bool doit, GucSource source)
{
- if (strcasecmp(facility, "LOCAL0") == 0)
+ if (pg_strcasecmp(facility, "LOCAL0") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL1") == 0)
+ if (pg_strcasecmp(facility, "LOCAL1") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL2") == 0)
+ if (pg_strcasecmp(facility, "LOCAL2") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL3") == 0)
+ if (pg_strcasecmp(facility, "LOCAL3") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL4") == 0)
+ if (pg_strcasecmp(facility, "LOCAL4") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL5") == 0)
+ if (pg_strcasecmp(facility, "LOCAL5") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL6") == 0)
+ if (pg_strcasecmp(facility, "LOCAL6") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL7") == 0)
+ if (pg_strcasecmp(facility, "LOCAL7") == 0)
return facility;
return NULL;
}
static const char *
assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "serializable") == 0)
+ if (pg_strcasecmp(newval, "serializable") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_SERIALIZABLE;
}
- else if (strcasecmp(newval, "repeatable read") == 0)
+ else if (pg_strcasecmp(newval, "repeatable read") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_REPEATABLE_READ;
}
- else if (strcasecmp(newval, "read committed") == 0)
+ else if (pg_strcasecmp(newval, "read committed") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_READ_COMMITTED;
}
- else if (strcasecmp(newval, "read uncommitted") == 0)
+ else if (pg_strcasecmp(newval, "read uncommitted") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_READ_UNCOMMITTED;
static const char *
assign_msglvl(int *var, const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "debug") == 0)
+ if (pg_strcasecmp(newval, "debug") == 0)
{
if (doit)
(*var) = DEBUG2;
}
- else if (strcasecmp(newval, "debug5") == 0)
+ else if (pg_strcasecmp(newval, "debug5") == 0)
{
if (doit)
(*var) = DEBUG5;
}
- else if (strcasecmp(newval, "debug4") == 0)
+ else if (pg_strcasecmp(newval, "debug4") == 0)
{
if (doit)
(*var) = DEBUG4;
}
- else if (strcasecmp(newval, "debug3") == 0)
+ else if (pg_strcasecmp(newval, "debug3") == 0)
{
if (doit)
(*var) = DEBUG3;
}
- else if (strcasecmp(newval, "debug2") == 0)
+ else if (pg_strcasecmp(newval, "debug2") == 0)
{
if (doit)
(*var) = DEBUG2;
}
- else if (strcasecmp(newval, "debug1") == 0)
+ else if (pg_strcasecmp(newval, "debug1") == 0)
{
if (doit)
(*var) = DEBUG1;
}
- else if (strcasecmp(newval, "log") == 0)
+ else if (pg_strcasecmp(newval, "log") == 0)
{
if (doit)
(*var) = LOG;
}
- else if (strcasecmp(newval, "info") == 0)
+ else if (pg_strcasecmp(newval, "info") == 0)
{
if (doit)
(*var) = INFO;
}
- else if (strcasecmp(newval, "notice") == 0)
+ else if (pg_strcasecmp(newval, "notice") == 0)
{
if (doit)
(*var) = NOTICE;
}
- else if (strcasecmp(newval, "warning") == 0)
+ else if (pg_strcasecmp(newval, "warning") == 0)
{
if (doit)
(*var) = WARNING;
}
- else if (strcasecmp(newval, "error") == 0)
+ else if (pg_strcasecmp(newval, "error") == 0)
{
if (doit)
(*var) = ERROR;
}
/* We allow FATAL/PANIC for client-side messages too. */
- else if (strcasecmp(newval, "fatal") == 0)
+ else if (pg_strcasecmp(newval, "fatal") == 0)
{
if (doit)
(*var) = FATAL;
}
- else if (strcasecmp(newval, "panic") == 0)
+ else if (pg_strcasecmp(newval, "panic") == 0)
{
if (doit)
(*var) = PANIC;
static const char *
assign_log_error_verbosity(const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "terse") == 0)
+ if (pg_strcasecmp(newval, "terse") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_TERSE;
}
- else if (strcasecmp(newval, "default") == 0)
+ else if (pg_strcasecmp(newval, "default") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_DEFAULT;
}
- else if (strcasecmp(newval, "verbose") == 0)
+ else if (pg_strcasecmp(newval, "verbose") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_VERBOSE;
static const char *
assign_log_stmtlvl(int *var, const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "none") == 0)
+ if (pg_strcasecmp(newval, "none") == 0)
{
if (doit)
(*var) = LOGSTMT_NONE;
}
- else if (strcasecmp(newval, "mod") == 0)
+ else if (pg_strcasecmp(newval, "mod") == 0)
{
if (doit)
(*var) = LOGSTMT_MOD;
}
- else if (strcasecmp(newval, "ddl") == 0)
+ else if (pg_strcasecmp(newval, "ddl") == 0)
{
if (doit)
(*var) = LOGSTMT_DDL;
}
- else if (strcasecmp(newval, "all") == 0)
+ else if (pg_strcasecmp(newval, "all") == 0)
{
if (doit)
(*var) = LOGSTMT_ALL;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.42 2004/03/03 21:28:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.43 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* Get a copy of the COPY statement and clean it up */
tmpCopy = strdup(te->copyStmt);
for (i = 0; i < strlen(tmpCopy); i++)
- tmpCopy[i] = tolower((unsigned char) tmpCopy[i]);
+ tmpCopy[i] = pg_tolower((unsigned char) tmpCopy[i]);
/*
* This is very nasty; we don't know if the archive used WITH
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.115 2004/03/27 18:01:40 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.116 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres_fe.h"
#include "command.h"
}
/* \copy */
- else if (strcasecmp(cmd, "copy") == 0)
+ else if (pg_strcasecmp(cmd, "copy") == 0)
{
char *opt = psql_scan_slash_option(scan_state,
OT_WHOLE_LINE, NULL, false);
{
if (!value)
;
- else if (strncasecmp("unaligned", value, vallen) == 0)
+ else if (pg_strncasecmp("unaligned", value, vallen) == 0)
popt->topt.format = PRINT_UNALIGNED;
- else if (strncasecmp("aligned", value, vallen) == 0)
+ else if (pg_strncasecmp("aligned", value, vallen) == 0)
popt->topt.format = PRINT_ALIGNED;
- else if (strncasecmp("html", value, vallen) == 0)
+ else if (pg_strncasecmp("html", value, vallen) == 0)
popt->topt.format = PRINT_HTML;
- else if (strncasecmp("latex", value, vallen) == 0)
+ else if (pg_strncasecmp("latex", value, vallen) == 0)
popt->topt.format = PRINT_LATEX;
else
{
/* toggle use of pager */
else if (strcmp(param, "pager") == 0)
{
- if (value && strcasecmp(value, "always") == 0)
+ if (value && pg_strcasecmp(value, "always") == 0)
popt->topt.pager = 2;
else if (popt->topt.pager == 1)
popt->topt.pager = 0;
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.85 2004/03/21 22:29:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.86 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
while (isalpha((unsigned char) query[wordlen]))
wordlen++;
- if (wordlen == 5 && strncasecmp(query, "begin", 5) == 0)
+ if (wordlen == 5 && pg_strncasecmp(query, "begin", 5) == 0)
return true;
- if (wordlen == 6 && strncasecmp(query, "commit", 6) == 0)
+ if (wordlen == 6 && pg_strncasecmp(query, "commit", 6) == 0)
return true;
- if (wordlen == 8 && strncasecmp(query, "rollback", 8) == 0)
+ if (wordlen == 8 && pg_strncasecmp(query, "rollback", 8) == 0)
return true;
- if (wordlen == 5 && strncasecmp(query, "abort", 5) == 0)
+ if (wordlen == 5 && pg_strncasecmp(query, "abort", 5) == 0)
return true;
- if (wordlen == 3 && strncasecmp(query, "end", 3) == 0)
+ if (wordlen == 3 && pg_strncasecmp(query, "end", 3) == 0)
return true;
- if (wordlen == 5 && strncasecmp(query, "start", 5) == 0)
+ if (wordlen == 5 && pg_strncasecmp(query, "start", 5) == 0)
return true;
return false;
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.46 2004/04/21 00:34:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.47 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres_fe.h"
#include "copy.h"
#include "stringutils.h"
#if defined(WIN32) && (!defined(__MINGW32__))
-#define strcasecmp(x,y) stricmp(x,y)
#define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
#define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
#endif
#ifdef NOT_USED
/* this is not implemented yet */
- if (strcasecmp(token, "binary") == 0)
+ if (pg_strcasecmp(token, "binary") == 0)
{
result->binary = true;
token = strtokx(NULL, whitespace, ".,()", "\"",
/*
* Allows old COPY syntax for backward compatibility 2002-06-19
*/
- if (strcasecmp(token, "with") == 0)
+ if (pg_strcasecmp(token, "with") == 0)
{
token = strtokx(NULL, whitespace, NULL, NULL,
0, false, pset.encoding);
- if (!token || strcasecmp(token, "oids") != 0)
+ if (!token || pg_strcasecmp(token, "oids") != 0)
goto error;
result->oids = true;
goto error;
}
- if (strcasecmp(token, "from") == 0)
+ if (pg_strcasecmp(token, "from") == 0)
result->from = true;
- else if (strcasecmp(token, "to") == 0)
+ else if (pg_strcasecmp(token, "to") == 0)
result->from = false;
else
goto error;
if (!token)
goto error;
- if (strcasecmp(token, "stdin") == 0 ||
- strcasecmp(token, "stdout") == 0)
+ if (pg_strcasecmp(token, "stdin") == 0 ||
+ pg_strcasecmp(token, "stdout") == 0)
{
result->psql_inout = false;
result->file = NULL;
}
- else if (strcasecmp(token, "pstdin") == 0 ||
- strcasecmp(token, "pstdout") == 0)
+ else if (pg_strcasecmp(token, "pstdin") == 0 ||
+ pg_strcasecmp(token, "pstdout") == 0)
{
result->psql_inout = true;
result->file = NULL;
/*
* Allows old COPY syntax for backward compatibility 2002-06-19
*/
- if (token && strcasecmp(token, "using") == 0)
+ if (token && pg_strcasecmp(token, "using") == 0)
{
token = strtokx(NULL, whitespace, NULL, NULL,
0, false, pset.encoding);
- if (!(token && strcasecmp(token, "delimiters") == 0))
+ if (!(token && pg_strcasecmp(token, "delimiters") == 0))
goto error;
}
- if (token && strcasecmp(token, "delimiters") == 0)
+ if (token && pg_strcasecmp(token, "delimiters") == 0)
{
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
* WITH is optional. Also, the backend will allow WITH followed by
* nothing, so we do too.
*/
- if (strcasecmp(token, "with") == 0)
+ if (pg_strcasecmp(token, "with") == 0)
token = strtokx(NULL, whitespace, NULL, NULL,
0, false, pset.encoding);
fetch_next = true;
/* someday allow BINARY here */
- if (strcasecmp(token, "oids") == 0)
+ if (pg_strcasecmp(token, "oids") == 0)
{
result->oids = true;
}
- else if (strcasecmp(token, "csv") == 0)
+ else if (pg_strcasecmp(token, "csv") == 0)
{
result->csv_mode = true;
}
- else if (strcasecmp(token, "delimiter") == 0)
+ else if (pg_strcasecmp(token, "delimiter") == 0)
{
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
- if (token && strcasecmp(token, "as") == 0)
+ if (token && pg_strcasecmp(token, "as") == 0)
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
if (token)
else
goto error;
}
- else if (strcasecmp(token, "null") == 0)
+ else if (pg_strcasecmp(token, "null") == 0)
{
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
- if (token && strcasecmp(token, "as") == 0)
+ if (token && pg_strcasecmp(token, "as") == 0)
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
if (token)
else
goto error;
}
- else if (strcasecmp(token, "quote") == 0)
+ else if (pg_strcasecmp(token, "quote") == 0)
{
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
- if (token && strcasecmp(token, "as") == 0)
+ if (token && pg_strcasecmp(token, "as") == 0)
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
if (token)
else
goto error;
}
- else if (strcasecmp(token, "escape") == 0)
+ else if (pg_strcasecmp(token, "escape") == 0)
{
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
- if (token && strcasecmp(token, "as") == 0)
+ if (token && pg_strcasecmp(token, "as") == 0)
token = strtokx(NULL, whitespace, NULL, "'",
'\\', false, pset.encoding);
if (token)
else
goto error;
}
- else if (strcasecmp(token, "force") == 0)
+ else if (pg_strcasecmp(token, "force") == 0)
{
token = strtokx(NULL, whitespace, ",", "\"",
0, false, pset.encoding);
- if (strcasecmp(token, "quote") == 0)
+ if (pg_strcasecmp(token, "quote") == 0)
{
/* handle column list */
fetch_next = false;
xstrcat(&result->force_quote_list, token);
}
}
- else if (strcasecmp(token, "not") == 0)
+ else if (pg_strcasecmp(token, "not") == 0)
{
token = strtokx(NULL, whitespace, ",", "\"",
0, false, pset.encoding);
- if (strcasecmp(token, "null") != 0)
+ if (pg_strcasecmp(token, "null") != 0)
goto error;
/* handle column list */
fetch_next = false;
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.97 2004/04/22 17:38:16 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.98 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
else if (!inquotes && isupper((unsigned char) *cp))
{
appendPQExpBufferChar(&namebuf,
- tolower((unsigned char) *cp));
+ pg_tolower((unsigned char) *cp));
cp++;
}
else if (!inquotes && *cp == '*')
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.86 2004/03/22 03:38:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.87 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
/* Count newlines for pager */
for (i = 0; QL_HELP[i].cmd; i++)
{
- if (strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
+ if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
strcmp(topic, "*") == 0)
{
nl_count += 5;
if (*ch == '\n')
nl_count++;
/* If we have an exact match, exit. Fixes \h SELECT */
- if (strcasecmp(topic, QL_HELP[i].cmd) == 0)
+ if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break;
}
}
for (i = 0; QL_HELP[i].cmd; i++)
{
- if (strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
+ if (pg_strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
strcmp(topic, "*") == 0)
{
help_found = true;
gettext(QL_HELP[i].help),
gettext(QL_HELP[i].syntax));
/* If we have an exact match, exit. Fixes \h SELECT */
- if (strcasecmp(topic, QL_HELP[i].cmd) == 0)
+ if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break;
}
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.2 2004/02/24 21:45:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.3 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
else
{
if (!inquotes && type == OT_SQLID)
- {
- if (isupper((unsigned char) *cp))
- *cp = tolower((unsigned char) *cp);
- }
+ *cp = pg_tolower((unsigned char) *cp);
cp += PQmblen(cp, pset.encoding);
}
}
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.104 2004/04/05 03:02:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
*/
/*----------------------------------------------------------------------
/* CREATE or DROP but not ALTER TABLE sth DROP */
/* complete with something you can create or drop */
- else if (strcasecmp(prev_wd, "CREATE") == 0 ||
- (strcasecmp(prev_wd, "DROP") == 0 &&
- strcasecmp(prev3_wd, "TABLE") != 0))
+ else if (pg_strcasecmp(prev_wd, "CREATE") == 0 ||
+ (pg_strcasecmp(prev_wd, "DROP") == 0 &&
+ pg_strcasecmp(prev3_wd, "TABLE") != 0))
matches = completion_matches(text, create_command_generator);
/* ALTER */
* complete with what you can alter (TABLE, GROUP, USER, ...) unless
* we're in ALTER TABLE sth ALTER
*/
- else if (strcasecmp(prev_wd, "ALTER") == 0 &&
- strcasecmp(prev3_wd, "TABLE") != 0)
+ else if (pg_strcasecmp(prev_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev3_wd, "TABLE") != 0)
{
static const char *const list_ALTER[] =
{"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
}
/* ALTER DATABASE <name> */
- else if (strcasecmp(prev3_wd, "ALTER") == 0 &&
- strcasecmp(prev2_wd, "DATABASE") == 0)
+ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev2_wd, "DATABASE") == 0)
{
static const char *const list_ALTERDATABASE[] =
{"RESET", "SET", "RENAME TO", NULL};
COMPLETE_WITH_LIST(list_ALTERDATABASE);
}
/* ALTER TRIGGER <name>, add ON */
- else if (strcasecmp(prev3_wd, "ALTER") == 0 &&
- strcasecmp(prev2_wd, "TRIGGER") == 0)
+ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
COMPLETE_WITH_CONST("ON");
/*
* If we have ALTER TRIGGER <sth> ON, then add the correct tablename
*/
- else if (strcasecmp(prev4_wd, "ALTER") == 0 &&
- strcasecmp(prev3_wd, "TRIGGER") == 0 &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/*
* If we detect ALTER TABLE <name>, suggest either ADD, DROP, ALTER,
* RENAME, or OWNER
*/
- else if (strcasecmp(prev3_wd, "ALTER") == 0 &&
- strcasecmp(prev2_wd, "TABLE") == 0)
+ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev2_wd, "TABLE") == 0)
{
static const char *const list_ALTER2[] =
{"ADD", "ALTER", "DROP", "RENAME", "OWNER TO", NULL};
COMPLETE_WITH_LIST(list_ALTER2);
}
/* If we have TABLE <sth> ALTER|RENAME, provide list of columns */
- else if (strcasecmp(prev3_wd, "TABLE") == 0 &&
- (strcasecmp(prev_wd, "ALTER") == 0 ||
- strcasecmp(prev_wd, "RENAME") == 0))
+ else if (pg_strcasecmp(prev3_wd, "TABLE") == 0 &&
+ (pg_strcasecmp(prev_wd, "ALTER") == 0 ||
+ pg_strcasecmp(prev_wd, "RENAME") == 0))
COMPLETE_WITH_ATTR(prev2_wd);
/* If we have TABLE <sth> DROP, provide COLUMN or CONSTRAINT */
- else if (strcasecmp(prev3_wd, "TABLE") == 0 &&
- strcasecmp(prev_wd, "DROP") == 0)
+ else if (pg_strcasecmp(prev3_wd, "TABLE") == 0 &&
+ pg_strcasecmp(prev_wd, "DROP") == 0)
{
static const char *const list_TABLEDROP[] =
{"COLUMN", "CONSTRAINT", NULL};
COMPLETE_WITH_LIST(list_TABLEDROP);
}
/* If we have TABLE <sth> DROP COLUMN, provide list of columns */
- else if (strcasecmp(prev4_wd, "TABLE") == 0 &&
- strcasecmp(prev2_wd, "DROP") == 0 &&
- strcasecmp(prev_wd, "COLUMN") == 0)
+ else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
+ pg_strcasecmp(prev2_wd, "DROP") == 0 &&
+ pg_strcasecmp(prev_wd, "COLUMN") == 0)
COMPLETE_WITH_ATTR(prev3_wd);
/* complete ALTER GROUP <foo> with ADD or DROP */
- else if (strcasecmp(prev3_wd, "ALTER") == 0 &&
- strcasecmp(prev2_wd, "GROUP") == 0)
+ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev2_wd, "GROUP") == 0)
{
static const char *const list_ALTERGROUP[] =
{"ADD", "DROP", NULL};
COMPLETE_WITH_LIST(list_ALTERGROUP);
}
/* complete ALTER GROUP <foo> ADD|DROP with USER */
- else if (strcasecmp(prev4_wd, "ALTER") == 0 &&
- strcasecmp(prev3_wd, "GROUP") == 0 &&
- (strcasecmp(prev_wd, "ADD") == 0 ||
- strcasecmp(prev_wd, "DROP") == 0))
+ else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev3_wd, "GROUP") == 0 &&
+ (pg_strcasecmp(prev_wd, "ADD") == 0 ||
+ pg_strcasecmp(prev_wd, "DROP") == 0))
COMPLETE_WITH_CONST("USER");
/* complete {ALTER} GROUP <foo> ADD|DROP USER with a user name */
- else if (strcasecmp(prev4_wd, "GROUP") == 0 &&
- (strcasecmp(prev2_wd, "ADD") == 0 ||
- strcasecmp(prev2_wd, "DROP") == 0) &&
- strcasecmp(prev_wd, "USER") == 0)
+ else if (pg_strcasecmp(prev4_wd, "GROUP") == 0 &&
+ (pg_strcasecmp(prev2_wd, "ADD") == 0 ||
+ pg_strcasecmp(prev2_wd, "DROP") == 0) &&
+ pg_strcasecmp(prev_wd, "USER") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_users);
/* ANALYZE */
/* If the previous word is ANALYZE, produce list of tables. */
- else if (strcasecmp(prev_wd, "ANALYZE") == 0)
+ else if (pg_strcasecmp(prev_wd, "ANALYZE") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* If we have ANALYZE <table>, complete with semicolon. */
- else if (strcasecmp(prev2_wd, "ANALYZE") == 0)
+ else if (pg_strcasecmp(prev2_wd, "ANALYZE") == 0)
COMPLETE_WITH_CONST(";");
/* BEGIN, COMMIT, ROLLBACK, ABORT, */
- else if (strcasecmp(prev_wd, "BEGIN") == 0 ||
- strcasecmp(prev_wd, "END") == 0 ||
- strcasecmp(prev_wd, "COMMIT") == 0 ||
- strcasecmp(prev_wd, "ROLLBACK") == 0 ||
- strcasecmp(prev_wd, "ABORT") == 0)
+ else if (pg_strcasecmp(prev_wd, "BEGIN") == 0 ||
+ pg_strcasecmp(prev_wd, "END") == 0 ||
+ pg_strcasecmp(prev_wd, "COMMIT") == 0 ||
+ pg_strcasecmp(prev_wd, "ROLLBACK") == 0 ||
+ pg_strcasecmp(prev_wd, "ABORT") == 0)
{
static const char * const list_TRANS[] =
{"WORK", "TRANSACTION", NULL};
}
/* CLUSTER */
/* If the previous word is CLUSTER, produce list of indexes. */
- else if (strcasecmp(prev_wd, "CLUSTER") == 0)
+ else if (pg_strcasecmp(prev_wd, "CLUSTER") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
/* If we have CLUSTER <sth>, then add "ON" */
- else if (strcasecmp(prev2_wd, "CLUSTER") == 0)
+ else if (pg_strcasecmp(prev2_wd, "CLUSTER") == 0)
COMPLETE_WITH_CONST("ON");
/*
* If we have CLUSTER <sth> ON, then add the correct tablename as
* well.
*/
- else if (strcasecmp(prev3_wd, "CLUSTER") == 0 &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev3_wd, "CLUSTER") == 0 &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
{
completion_info_charp = prev2_wd;
COMPLETE_WITH_QUERY(Query_for_table_owning_index);
}
/* COMMENT */
- else if (strcasecmp(prev_wd, "COMMENT") == 0)
+ else if (pg_strcasecmp(prev_wd, "COMMENT") == 0)
COMPLETE_WITH_CONST("ON");
- else if (strcasecmp(prev2_wd, "COMMENT") == 0 &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev2_wd, "COMMENT") == 0 &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
{
static const char *const list_COMMENT[] =
{"DATABASE", "INDEX", "RULE", "SCHEMA", "SEQUENCE", "TABLE",
COMPLETE_WITH_LIST(list_COMMENT);
}
- else if (strcasecmp(prev4_wd, "COMMENT") == 0 &&
- strcasecmp(prev3_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
+ pg_strcasecmp(prev3_wd, "ON") == 0)
COMPLETE_WITH_CONST("IS");
/* COPY */
* If we have COPY [BINARY] (which you'd have to type yourself), offer
* list of tables (Also cover the analogous backslash command)
*/
- else if (strcasecmp(prev_wd, "COPY") == 0 ||
- strcasecmp(prev_wd, "\\copy") == 0 ||
- (strcasecmp(prev2_wd, "COPY") == 0 &&
- strcasecmp(prev_wd, "BINARY") == 0))
+ else if (pg_strcasecmp(prev_wd, "COPY") == 0 ||
+ pg_strcasecmp(prev_wd, "\\copy") == 0 ||
+ (pg_strcasecmp(prev2_wd, "COPY") == 0 &&
+ pg_strcasecmp(prev_wd, "BINARY") == 0))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* If we have COPY|BINARY <sth>, complete it with "TO" or "FROM" */
- else if (strcasecmp(prev2_wd, "COPY") == 0 ||
- strcasecmp(prev2_wd, "\\copy") == 0 ||
- strcasecmp(prev2_wd, "BINARY") == 0)
+ else if (pg_strcasecmp(prev2_wd, "COPY") == 0 ||
+ pg_strcasecmp(prev2_wd, "\\copy") == 0 ||
+ pg_strcasecmp(prev2_wd, "BINARY") == 0)
{
static const char *const list_FROMTO[] =
{"FROM", "TO", NULL};
/* CREATE INDEX */
/* First off we complete CREATE UNIQUE with "INDEX" */
- else if (strcasecmp(prev2_wd, "CREATE") == 0 &&
- strcasecmp(prev_wd, "UNIQUE") == 0)
+ else if (pg_strcasecmp(prev2_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev_wd, "UNIQUE") == 0)
COMPLETE_WITH_CONST("INDEX");
/* If we have CREATE|UNIQUE INDEX <sth>, then add "ON" */
- else if (strcasecmp(prev2_wd, "INDEX") == 0 &&
- (strcasecmp(prev3_wd, "CREATE") == 0 ||
- strcasecmp(prev3_wd, "UNIQUE") == 0))
+ else if (pg_strcasecmp(prev2_wd, "INDEX") == 0 &&
+ (pg_strcasecmp(prev3_wd, "CREATE") == 0 ||
+ pg_strcasecmp(prev3_wd, "UNIQUE") == 0))
COMPLETE_WITH_CONST("ON");
/* Complete ... INDEX <name> ON with a list of tables */
- else if (strcasecmp(prev3_wd, "INDEX") == 0 &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev3_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/*
* Complete INDEX <name> ON <table> with a list of table columns
* (which should really be in parens)
*/
- else if (strcasecmp(prev4_wd, "INDEX") == 0 &&
- strcasecmp(prev2_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev2_wd, "ON") == 0)
COMPLETE_WITH_ATTR(prev_wd);
/* same if you put in USING */
- else if (strcasecmp(prev4_wd, "ON") == 0 &&
- strcasecmp(prev2_wd, "USING") == 0)
+ else if (pg_strcasecmp(prev4_wd, "ON") == 0 &&
+ pg_strcasecmp(prev2_wd, "USING") == 0)
COMPLETE_WITH_ATTR(prev3_wd);
/* Complete USING with an index method */
- else if (strcasecmp(prev_wd, "USING") == 0)
+ else if (pg_strcasecmp(prev_wd, "USING") == 0)
{
static const char *const index_mth[] =
{"BTREE", "RTREE", "HASH", "GIST", NULL};
/* CREATE RULE */
/* Complete "CREATE RULE <sth>" with "AS" */
- else if (strcasecmp(prev3_wd, "CREATE") == 0 &&
- strcasecmp(prev2_wd, "RULE") == 0)
+ else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev2_wd, "RULE") == 0)
COMPLETE_WITH_CONST("AS");
/* Complete "CREATE RULE <sth> AS with "ON" */
- else if (strcasecmp(prev4_wd, "CREATE") == 0 &&
- strcasecmp(prev3_wd, "RULE") == 0 &&
- strcasecmp(prev_wd, "AS") == 0)
+ else if (pg_strcasecmp(prev4_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev3_wd, "RULE") == 0 &&
+ pg_strcasecmp(prev_wd, "AS") == 0)
COMPLETE_WITH_CONST("ON");
/* Complete "RULE * AS ON" with SELECT|UPDATE|DELETE|INSERT */
- else if (strcasecmp(prev4_wd, "RULE") == 0 &&
- strcasecmp(prev2_wd, "AS") == 0 &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if (pg_strcasecmp(prev4_wd, "RULE") == 0 &&
+ pg_strcasecmp(prev2_wd, "AS") == 0 &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
{
static const char *const rule_events[] =
{"SELECT", "UPDATE", "INSERT", "DELETE", NULL};
COMPLETE_WITH_LIST(rule_events);
}
/* Complete "AS ON <sth with a 'T' :)>" with a "TO" */
- else if (strcasecmp(prev3_wd, "AS") == 0 &&
- strcasecmp(prev2_wd, "ON") == 0 &&
+ else if (pg_strcasecmp(prev3_wd, "AS") == 0 &&
+ pg_strcasecmp(prev2_wd, "ON") == 0 &&
(toupper((unsigned char) prev_wd[4]) == 'T' ||
toupper((unsigned char) prev_wd[5]) == 'T'))
COMPLETE_WITH_CONST("TO");
/* Complete "AS ON <sth> TO" with a table name */
- else if (strcasecmp(prev4_wd, "AS") == 0 &&
- strcasecmp(prev3_wd, "ON") == 0 &&
- strcasecmp(prev_wd, "TO") == 0)
+ else if (pg_strcasecmp(prev4_wd, "AS") == 0 &&
+ pg_strcasecmp(prev3_wd, "ON") == 0 &&
+ pg_strcasecmp(prev_wd, "TO") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* CREATE TABLE */
/* Complete CREATE TEMP with "TABLE" */
- else if (strcasecmp(prev2_wd, "CREATE") == 0 &&
- strcasecmp(prev_wd, "TEMP") == 0)
+ else if (pg_strcasecmp(prev2_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev_wd, "TEMP") == 0)
COMPLETE_WITH_CONST("TABLE");
/* CREATE TRIGGER */
/* CREATE VIEW */
/* Complete "CREATE VIEW <name>" with "AS" */
- else if (strcasecmp(prev3_wd, "CREATE") == 0 &&
- strcasecmp(prev2_wd, "VIEW") == 0)
+ else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev2_wd, "VIEW") == 0)
COMPLETE_WITH_CONST("AS");
/* Complete "CREATE VIEW <sth> AS with "SELECT" */
- else if (strcasecmp(prev4_wd, "CREATE") == 0 &&
- strcasecmp(prev3_wd, "VIEW") == 0 &&
- strcasecmp(prev_wd, "AS") == 0)
+ else if (pg_strcasecmp(prev4_wd, "CREATE") == 0 &&
+ pg_strcasecmp(prev3_wd, "VIEW") == 0 &&
+ pg_strcasecmp(prev_wd, "AS") == 0)
COMPLETE_WITH_CONST("SELECT");
/* DELETE */
* Complete DELETE with FROM (only if the word before that is not "ON"
* (cf. rules) or "BEFORE" or "AFTER" (cf. triggers) or GRANT)
*/
- else if (strcasecmp(prev_wd, "DELETE") == 0 &&
- !(strcasecmp(prev2_wd, "ON") == 0 ||
- strcasecmp(prev2_wd, "GRANT") == 0 ||
- strcasecmp(prev2_wd, "BEFORE") == 0 ||
- strcasecmp(prev2_wd, "AFTER") == 0))
+ else if (pg_strcasecmp(prev_wd, "DELETE") == 0 &&
+ !(pg_strcasecmp(prev2_wd, "ON") == 0 ||
+ pg_strcasecmp(prev2_wd, "GRANT") == 0 ||
+ pg_strcasecmp(prev2_wd, "BEFORE") == 0 ||
+ pg_strcasecmp(prev2_wd, "AFTER") == 0))
COMPLETE_WITH_CONST("FROM");
/* Complete DELETE FROM with a list of tables */
- else if (strcasecmp(prev2_wd, "DELETE") == 0 &&
- strcasecmp(prev_wd, "FROM") == 0)
+ else if (pg_strcasecmp(prev2_wd, "DELETE") == 0 &&
+ pg_strcasecmp(prev_wd, "FROM") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* Complete DELETE FROM <table> with "WHERE" (perhaps a safe idea?) */
- else if (strcasecmp(prev3_wd, "DELETE") == 0 &&
- strcasecmp(prev2_wd, "FROM") == 0)
+ else if (pg_strcasecmp(prev3_wd, "DELETE") == 0 &&
+ pg_strcasecmp(prev2_wd, "FROM") == 0)
COMPLETE_WITH_CONST("WHERE");
/* EXPLAIN */
* Complete EXPLAIN [VERBOSE] (which you'd have to type yourself) with
* the list of SQL commands
*/
- else if (strcasecmp(prev_wd, "EXPLAIN") == 0 ||
- (strcasecmp(prev2_wd, "EXPLAIN") == 0 &&
- strcasecmp(prev_wd, "VERBOSE") == 0))
+ else if (pg_strcasecmp(prev_wd, "EXPLAIN") == 0 ||
+ (pg_strcasecmp(prev2_wd, "EXPLAIN") == 0 &&
+ pg_strcasecmp(prev_wd, "VERBOSE") == 0))
COMPLETE_WITH_LIST(sql_commands);
/* FETCH && MOVE */
/* Complete FETCH with one of FORWARD, BACKWARD, RELATIVE */
- else if (strcasecmp(prev_wd, "FETCH") == 0 ||
- strcasecmp(prev_wd, "MOVE") == 0)
+ else if (pg_strcasecmp(prev_wd, "FETCH") == 0 ||
+ pg_strcasecmp(prev_wd, "MOVE") == 0)
{
static const char * const list_FETCH1[] =
{"FORWARD", "BACKWARD", "RELATIVE", NULL};
COMPLETE_WITH_LIST(list_FETCH1);
}
/* Complete FETCH <sth> with one of ALL, NEXT, PRIOR */
- else if (strcasecmp(prev2_wd, "FETCH") == 0 ||
- strcasecmp(prev2_wd, "MOVE") == 0)
+ else if (pg_strcasecmp(prev2_wd, "FETCH") == 0 ||
+ pg_strcasecmp(prev2_wd, "MOVE") == 0)
{
static const char * const list_FETCH2[] =
{"ALL", "NEXT", "PRIOR", NULL};
* Complete FETCH <sth1> <sth2> with "FROM" or "TO". (Is there a
* difference? If not, remove one.)
*/
- else if (strcasecmp(prev3_wd, "FETCH") == 0 ||
- strcasecmp(prev3_wd, "MOVE") == 0)
+ else if (pg_strcasecmp(prev3_wd, "FETCH") == 0 ||
+ pg_strcasecmp(prev3_wd, "MOVE") == 0)
{
static const char * const list_FROMTO[] =
{"FROM", "TO", NULL};
/* GRANT && REVOKE*/
/* Complete GRANT/REVOKE with a list of privileges */
- else if (strcasecmp(prev_wd, "GRANT") == 0 ||
- strcasecmp(prev_wd, "REVOKE") == 0)
+ else if (pg_strcasecmp(prev_wd, "GRANT") == 0 ||
+ pg_strcasecmp(prev_wd, "REVOKE") == 0)
{
static const char * const list_privileg[] =
{"SELECT", "INSERT", "UPDATE", "DELETE", "RULE", "REFERENCES",
COMPLETE_WITH_LIST(list_privileg);
}
/* Complete GRANT/REVOKE <sth> with "ON" */
- else if (strcasecmp(prev2_wd, "GRANT") == 0 ||
- strcasecmp(prev2_wd, "REVOKE") == 0)
+ else if (pg_strcasecmp(prev2_wd, "GRANT") == 0 ||
+ pg_strcasecmp(prev2_wd, "REVOKE") == 0)
COMPLETE_WITH_CONST("ON");
/*
* implemented here will only work if the privilege list contains
* exactly one privilege
*/
- else if ((strcasecmp(prev3_wd, "GRANT") == 0 ||
- strcasecmp(prev3_wd, "REVOKE") == 0) &&
- strcasecmp(prev_wd, "ON") == 0)
+ else if ((pg_strcasecmp(prev3_wd, "GRANT") == 0 ||
+ pg_strcasecmp(prev3_wd, "REVOKE") == 0) &&
+ pg_strcasecmp(prev_wd, "ON") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tsv,
" UNION SELECT 'DATABASE'"
" UNION SELECT 'FUNCTION'"
" UNION SELECT 'SCHEMA'");
/* Complete "GRANT/REVOKE * ON * " with "TO" */
- else if ((strcasecmp(prev4_wd, "GRANT") == 0 ||
- strcasecmp(prev4_wd, "REVOKE") == 0) &&
- strcasecmp(prev2_wd, "ON") == 0)
+ else if ((pg_strcasecmp(prev4_wd, "GRANT") == 0 ||
+ pg_strcasecmp(prev4_wd, "REVOKE") == 0) &&
+ pg_strcasecmp(prev2_wd, "ON") == 0)
{
- if (strcasecmp(prev_wd, "DATABASE") == 0)
+ if (pg_strcasecmp(prev_wd, "DATABASE") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_databases);
- else if (strcasecmp(prev_wd, "FUNCTION") == 0)
+ else if (pg_strcasecmp(prev_wd, "FUNCTION") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_functions, NULL);
- else if (strcasecmp(prev_wd, "LANGUAGE") == 0)
+ else if (pg_strcasecmp(prev_wd, "LANGUAGE") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_languages);
- else if (strcasecmp(prev_wd, "SCHEMA") == 0)
+ else if (pg_strcasecmp(prev_wd, "SCHEMA") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
else
COMPLETE_WITH_CONST("TO");
/* INSERT */
/* Complete INSERT with "INTO" */
- else if (strcasecmp(prev_wd, "INSERT") == 0)
+ else if (pg_strcasecmp(prev_wd, "INSERT") == 0)
COMPLETE_WITH_CONST("INTO");
/* Complete INSERT INTO with table names */
- else if (strcasecmp(prev2_wd, "INSERT") == 0 &&
- strcasecmp(prev_wd, "INTO") == 0)
+ else if (pg_strcasecmp(prev2_wd, "INSERT") == 0 &&
+ pg_strcasecmp(prev_wd, "INTO") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* Complete "INSERT INTO <table> (" with attribute names */
else if (rl_line_buffer[start - 1] == '(' &&
- strcasecmp(prev3_wd, "INSERT") == 0 &&
- strcasecmp(prev2_wd, "INTO") == 0)
+ pg_strcasecmp(prev3_wd, "INSERT") == 0 &&
+ pg_strcasecmp(prev2_wd, "INTO") == 0)
COMPLETE_WITH_ATTR(prev_wd);
/*
* Complete INSERT INTO <table> with "VALUES" or "SELECT" or "DEFAULT
* VALUES"
*/
- else if (strcasecmp(prev3_wd, "INSERT") == 0 &&
- strcasecmp(prev2_wd, "INTO") == 0)
+ else if (pg_strcasecmp(prev3_wd, "INSERT") == 0 &&
+ pg_strcasecmp(prev2_wd, "INTO") == 0)
{
static const char * const list_INSERT[] =
{"DEFAULT VALUES", "SELECT", "VALUES", NULL};
COMPLETE_WITH_LIST(list_INSERT);
}
/* Complete INSERT INTO <table> (attribs) with "VALUES" or "SELECT" */
- else if (strcasecmp(prev4_wd, "INSERT") == 0 &&
- strcasecmp(prev3_wd, "INTO") == 0 &&
+ else if (pg_strcasecmp(prev4_wd, "INSERT") == 0 &&
+ pg_strcasecmp(prev3_wd, "INTO") == 0 &&
prev_wd[strlen(prev_wd) - 1] == ')')
{
static const char * const list_INSERT[] =
}
/* Insert an open parenthesis after "VALUES" */
- else if (strcasecmp(prev_wd, "VALUES") == 0 &&
- strcasecmp(prev2_wd, "DEFAULT") != 0)
+ else if (pg_strcasecmp(prev_wd, "VALUES") == 0 &&
+ pg_strcasecmp(prev2_wd, "DEFAULT") != 0)
COMPLETE_WITH_CONST("(");
/* LOCK */
/* Complete LOCK [TABLE] with a list of tables */
- else if (strcasecmp(prev_wd, "LOCK") == 0 ||
- (strcasecmp(prev_wd, "TABLE") == 0 &&
- strcasecmp(prev2_wd, "LOCK") == 0))
+ else if (pg_strcasecmp(prev_wd, "LOCK") == 0 ||
+ (pg_strcasecmp(prev_wd, "TABLE") == 0 &&
+ pg_strcasecmp(prev2_wd, "LOCK") == 0))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* For the following, handle the case of a single table only for now */
/* Complete LOCK [TABLE] <table> with "IN" */
- else if ((strcasecmp(prev2_wd, "LOCK") == 0 &&
- strcasecmp(prev_wd, "TABLE")) ||
- (strcasecmp(prev2_wd, "TABLE") == 0 &&
- strcasecmp(prev3_wd, "LOCK") == 0))
+ else if ((pg_strcasecmp(prev2_wd, "LOCK") == 0 &&
+ pg_strcasecmp(prev_wd, "TABLE")) ||
+ (pg_strcasecmp(prev2_wd, "TABLE") == 0 &&
+ pg_strcasecmp(prev3_wd, "LOCK") == 0))
COMPLETE_WITH_CONST("IN");
/* Complete LOCK [TABLE] <table> IN with a lock mode */
- else if (strcasecmp(prev_wd, "IN") == 0 &&
- (strcasecmp(prev3_wd, "LOCK") == 0 ||
- (strcasecmp(prev3_wd, "TABLE") == 0 &&
- strcasecmp(prev4_wd, "LOCK") == 0)))
+ else if (pg_strcasecmp(prev_wd, "IN") == 0 &&
+ (pg_strcasecmp(prev3_wd, "LOCK") == 0 ||
+ (pg_strcasecmp(prev3_wd, "TABLE") == 0 &&
+ pg_strcasecmp(prev4_wd, "LOCK") == 0)))
{
static const char * const lock_modes[] =
{"ACCESS SHARE MODE",
}
/* NOTIFY */
- else if (strcasecmp(prev_wd, "NOTIFY") == 0)
+ else if (pg_strcasecmp(prev_wd, "NOTIFY") == 0)
COMPLETE_WITH_QUERY("SELECT pg_catalog.quote_ident(relname) FROM pg_catalog.pg_listener WHERE substring(pg_catalog.quote_ident(relname),1,%d)='%s'");
/* REINDEX */
- else if (strcasecmp(prev_wd, "REINDEX") == 0)
+ else if (pg_strcasecmp(prev_wd, "REINDEX") == 0)
{
static const char * const list_REINDEX[] =
{"TABLE", "DATABASE", "INDEX", NULL};
COMPLETE_WITH_LIST(list_REINDEX);
}
- else if (strcasecmp(prev2_wd, "REINDEX") == 0)
+ else if (pg_strcasecmp(prev2_wd, "REINDEX") == 0)
{
- if (strcasecmp(prev_wd, "TABLE") == 0)
+ if (pg_strcasecmp(prev_wd, "TABLE") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
- else if (strcasecmp(prev_wd, "DATABASE") == 0)
+ else if (pg_strcasecmp(prev_wd, "DATABASE") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_databases);
- else if (strcasecmp(prev_wd, "INDEX") == 0)
+ else if (pg_strcasecmp(prev_wd, "INDEX") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
}
/* SET, RESET, SHOW */
/* Complete with a variable name */
- else if ((strcasecmp(prev_wd, "SET") == 0 &&
- strcasecmp(prev3_wd, "UPDATE") != 0) ||
- strcasecmp(prev_wd, "RESET") == 0 ||
- strcasecmp(prev_wd, "SHOW") == 0)
+ else if ((pg_strcasecmp(prev_wd, "SET") == 0 &&
+ pg_strcasecmp(prev3_wd, "UPDATE") != 0) ||
+ pg_strcasecmp(prev_wd, "RESET") == 0 ||
+ pg_strcasecmp(prev_wd, "SHOW") == 0)
COMPLETE_WITH_LIST(pgsql_variables);
/* Complete "SET TRANSACTION" */
- else if ((strcasecmp(prev2_wd, "SET") == 0 &&
- strcasecmp(prev_wd, "TRANSACTION") == 0)
- || (strcasecmp(prev2_wd, "START") == 0
- && strcasecmp(prev_wd, "TRANSACTION") == 0)
- || (strcasecmp(prev2_wd, "BEGIN") == 0
- && strcasecmp(prev_wd, "WORK") == 0)
- || (strcasecmp(prev2_wd, "BEGIN") == 0
- && strcasecmp(prev_wd, "TRANSACTION") == 0)
- || (strcasecmp(prev4_wd, "SESSION") == 0
- && strcasecmp(prev3_wd, "CHARACTERISTICS") == 0
- && strcasecmp(prev2_wd, "AS") == 0
- && strcasecmp(prev_wd, "TRANSACTION") == 0))
+ else if ((pg_strcasecmp(prev2_wd, "SET") == 0 &&
+ pg_strcasecmp(prev_wd, "TRANSACTION") == 0)
+ || (pg_strcasecmp(prev2_wd, "START") == 0
+ && pg_strcasecmp(prev_wd, "TRANSACTION") == 0)
+ || (pg_strcasecmp(prev2_wd, "BEGIN") == 0
+ && pg_strcasecmp(prev_wd, "WORK") == 0)
+ || (pg_strcasecmp(prev2_wd, "BEGIN") == 0
+ && pg_strcasecmp(prev_wd, "TRANSACTION") == 0)
+ || (pg_strcasecmp(prev4_wd, "SESSION") == 0
+ && pg_strcasecmp(prev3_wd, "CHARACTERISTICS") == 0
+ && pg_strcasecmp(prev2_wd, "AS") == 0
+ && pg_strcasecmp(prev_wd, "TRANSACTION") == 0))
{
static const char * const my_list[] =
{"ISOLATION", "READ", NULL};
COMPLETE_WITH_LIST(my_list);
}
- else if ((strcasecmp(prev3_wd, "SET") == 0
- || strcasecmp(prev3_wd, "START") == 0
- || (strcasecmp(prev4_wd, "CHARACTERISTICS") == 0
- && strcasecmp(prev3_wd, "AS") == 0))
- && strcasecmp(prev2_wd, "TRANSACTION") == 0
- && strcasecmp(prev_wd, "ISOLATION") == 0)
+ else if ((pg_strcasecmp(prev3_wd, "SET") == 0
+ || pg_strcasecmp(prev3_wd, "START") == 0
+ || (pg_strcasecmp(prev4_wd, "CHARACTERISTICS") == 0
+ && pg_strcasecmp(prev3_wd, "AS") == 0))
+ && pg_strcasecmp(prev2_wd, "TRANSACTION") == 0
+ && pg_strcasecmp(prev_wd, "ISOLATION") == 0)
COMPLETE_WITH_CONST("LEVEL");
- else if ((strcasecmp(prev4_wd, "SET") == 0
- || strcasecmp(prev4_wd, "START") == 0
- || strcasecmp(prev4_wd, "AS") == 0)
- && strcasecmp(prev3_wd, "TRANSACTION") == 0
- && strcasecmp(prev2_wd, "ISOLATION") == 0
- && strcasecmp(prev_wd, "LEVEL") == 0)
+ else if ((pg_strcasecmp(prev4_wd, "SET") == 0
+ || pg_strcasecmp(prev4_wd, "START") == 0
+ || pg_strcasecmp(prev4_wd, "AS") == 0)
+ && pg_strcasecmp(prev3_wd, "TRANSACTION") == 0
+ && pg_strcasecmp(prev2_wd, "ISOLATION") == 0
+ && pg_strcasecmp(prev_wd, "LEVEL") == 0)
{
static const char * const my_list[] =
{"READ", "REPEATABLE", "SERIALIZABLE", NULL};
COMPLETE_WITH_LIST(my_list);
}
- else if (strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
- strcasecmp(prev3_wd, "ISOLATION") == 0 &&
- strcasecmp(prev2_wd, "LEVEL") == 0 &&
- strcasecmp(prev_wd, "READ") == 0)
+ else if (pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
+ pg_strcasecmp(prev3_wd, "ISOLATION") == 0 &&
+ pg_strcasecmp(prev2_wd, "LEVEL") == 0 &&
+ pg_strcasecmp(prev_wd, "READ") == 0)
{
static const char * const my_list[] =
{"UNCOMMITTED", "COMMITTED", NULL};
COMPLETE_WITH_LIST(my_list);
}
- else if (strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
- strcasecmp(prev3_wd, "ISOLATION") == 0 &&
- strcasecmp(prev2_wd, "LEVEL") == 0 &&
- strcasecmp(prev_wd, "REPEATABLE") == 0)
+ else if (pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
+ pg_strcasecmp(prev3_wd, "ISOLATION") == 0 &&
+ pg_strcasecmp(prev2_wd, "LEVEL") == 0 &&
+ pg_strcasecmp(prev_wd, "REPEATABLE") == 0)
COMPLETE_WITH_CONST("READ");
- else if ((strcasecmp(prev3_wd, "SET") == 0 ||
- strcasecmp(prev3_wd, "AS") == 0) &&
- strcasecmp(prev2_wd, "TRANSACTION") == 0 &&
- strcasecmp(prev_wd, "READ") == 0)
+ else if ((pg_strcasecmp(prev3_wd, "SET") == 0 ||
+ pg_strcasecmp(prev3_wd, "AS") == 0) &&
+ pg_strcasecmp(prev2_wd, "TRANSACTION") == 0 &&
+ pg_strcasecmp(prev_wd, "READ") == 0)
{
static const char * const my_list[] =
{"ONLY", "WRITE", NULL};
COMPLETE_WITH_LIST(my_list);
}
/* Complete SET CONSTRAINTS <foo> with DEFERRED|IMMEDIATE */
- else if (strcasecmp(prev3_wd, "SET") == 0 &&
- strcasecmp(prev2_wd, "CONSTRAINTS") == 0)
+ else if (pg_strcasecmp(prev3_wd, "SET") == 0 &&
+ pg_strcasecmp(prev2_wd, "CONSTRAINTS") == 0)
{
static const char * const constraint_list[] =
{"DEFERRED", "IMMEDIATE", NULL};
COMPLETE_WITH_LIST(constraint_list);
}
/* Complete SET SESSION with AUTHORIZATION or CHARACTERISTICS... */
- else if (strcasecmp(prev2_wd, "SET") == 0 &&
- strcasecmp(prev_wd, "SESSION") == 0)
+ else if (pg_strcasecmp(prev2_wd, "SET") == 0 &&
+ pg_strcasecmp(prev_wd, "SESSION") == 0)
{
static const char * const my_list[] =
{"AUTHORIZATION", "CHARACTERISTICS AS TRANSACTION", NULL};
COMPLETE_WITH_LIST(my_list);
}
/* Complete SET SESSION AUTHORIZATION with username */
- else if (strcasecmp(prev3_wd, "SET") == 0
- && strcasecmp(prev2_wd, "SESSION") == 0
- && strcasecmp(prev_wd, "AUTHORIZATION") == 0)
+ else if (pg_strcasecmp(prev3_wd, "SET") == 0
+ && pg_strcasecmp(prev2_wd, "SESSION") == 0
+ && pg_strcasecmp(prev_wd, "AUTHORIZATION") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_users);
/* Complete SET <var> with "TO" */
- else if (strcasecmp(prev2_wd, "SET") == 0 &&
- strcasecmp(prev4_wd, "UPDATE") != 0)
+ else if (pg_strcasecmp(prev2_wd, "SET") == 0 &&
+ pg_strcasecmp(prev4_wd, "UPDATE") != 0)
COMPLETE_WITH_CONST("TO");
/* Suggest possible variable values */
- else if (strcasecmp(prev3_wd, "SET") == 0 &&
- (strcasecmp(prev_wd, "TO") == 0 || strcmp(prev_wd, "=") == 0))
+ else if (pg_strcasecmp(prev3_wd, "SET") == 0 &&
+ (pg_strcasecmp(prev_wd, "TO") == 0 || strcmp(prev_wd, "=") == 0))
{
- if (strcasecmp(prev2_wd, "DateStyle") == 0)
+ if (pg_strcasecmp(prev2_wd, "DateStyle") == 0)
{
static const char * const my_list[] =
{"ISO", "SQL", "Postgres", "German",
COMPLETE_WITH_LIST(my_list);
}
- else if (strcasecmp(prev2_wd, "GEQO") == 0)
+ else if (pg_strcasecmp(prev2_wd, "GEQO") == 0)
{
static const char * const my_list[] =
{"ON", "OFF", "DEFAULT", NULL};
}
/* START TRANSACTION */
- else if (strcasecmp(prev_wd, "START") == 0)
+ else if (pg_strcasecmp(prev_wd, "START") == 0)
COMPLETE_WITH_CONST("TRANSACTION");
/* TRUNCATE */
- else if (strcasecmp(prev_wd, "TRUNCATE") == 0)
+ else if (pg_strcasecmp(prev_wd, "TRUNCATE") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* UNLISTEN */
- else if (strcasecmp(prev_wd, "UNLISTEN") == 0)
+ else if (pg_strcasecmp(prev_wd, "UNLISTEN") == 0)
COMPLETE_WITH_QUERY("SELECT pg_catalog.quote_ident(relname) FROM pg_catalog.pg_listener WHERE substring(pg_catalog.quote_ident(relname),1,%d)='%s' UNION SELECT '*'");
/* UPDATE */
/* If prev. word is UPDATE suggest a list of tables */
- else if (strcasecmp(prev_wd, "UPDATE") == 0)
+ else if (pg_strcasecmp(prev_wd, "UPDATE") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* Complete UPDATE <table> with "SET" */
- else if (strcasecmp(prev2_wd, "UPDATE") == 0)
+ else if (pg_strcasecmp(prev2_wd, "UPDATE") == 0)
COMPLETE_WITH_CONST("SET");
/*
* _first_ word) the word before it was (hopefully) a table name and
* we'll now make a list of attributes.
*/
- else if (strcasecmp(prev_wd, "SET") == 0)
+ else if (pg_strcasecmp(prev_wd, "SET") == 0)
COMPLETE_WITH_ATTR(prev2_wd);
/* VACUUM */
- else if (strcasecmp(prev_wd, "VACUUM") == 0)
+ else if (pg_strcasecmp(prev_wd, "VACUUM") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
" UNION SELECT 'FULL'"
" UNION SELECT 'ANALYZE'"
" UNION SELECT 'VERBOSE'");
- else if (strcasecmp(prev2_wd, "VACUUM") == 0 &&
- (strcasecmp(prev_wd, "FULL") == 0 ||
- strcasecmp(prev_wd, "ANALYZE") == 0 ||
- strcasecmp(prev_wd, "VERBOSE") == 0))
+ else if (pg_strcasecmp(prev2_wd, "VACUUM") == 0 &&
+ (pg_strcasecmp(prev_wd, "FULL") == 0 ||
+ pg_strcasecmp(prev_wd, "ANALYZE") == 0 ||
+ pg_strcasecmp(prev_wd, "VERBOSE") == 0))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* WHERE */
/* Simple case of the word before the where being the table name */
- else if (strcasecmp(prev_wd, "WHERE") == 0)
+ else if (pg_strcasecmp(prev_wd, "WHERE") == 0)
COMPLETE_WITH_ATTR(prev2_wd);
/* ... FROM ... */
/* TODO: also include SRF ? */
- else if (strcasecmp(prev_wd, "FROM") == 0)
+ else if (pg_strcasecmp(prev_wd, "FROM") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tsv, NULL);
for (i = 0; words_after_create[i].name; i++)
{
- if (strcasecmp(prev_wd, words_after_create[i].name) == 0)
+ if (pg_strcasecmp(prev_wd, words_after_create[i].name) == 0)
{
if (words_after_create[i].query)
COMPLETE_WITH_QUERY(words_after_create[i].query);
/* find something that matches */
while ((name = words_after_create[list_index++].name))
- if (strncasecmp(name, text, string_length) == 0)
+ if (pg_strncasecmp(name, text, string_length) == 0)
return pg_strdup(name);
/* if nothing matches, return NULL */
while (list_index < PQntuples(result) &&
(item = PQgetvalue(result, list_index++, 0)))
- if (strncasecmp(text, item, string_length) == 0)
+ if (pg_strncasecmp(text, item, string_length) == 0)
return pg_strdup(item);
}
}
/* Second pass is case insensitive, don't bother counting matches */
- if (!casesensitive && strncasecmp(text, item, string_length) == 0)
+ if (!casesensitive && pg_strncasecmp(text, item, string_length) == 0)
return pg_strdup(item);
}
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.163 2004/05/05 21:18:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.164 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#define memmove(d, s, c) bcopy(s, d, c)
#endif
-#ifndef HAVE_UNSETENV
-extern void unsetenv(const char *name);
-#endif
-
#ifndef DLLIMPORT
#define DLLIMPORT /* no special DLL markers on most ports */
#endif
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.27 2004/04/30 17:52:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.28 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* Portable delay handling */
extern void pg_usleep(long microsec);
+/* Portable SQL-like case-independent comparisons and conversions */
+extern int pg_strcasecmp(const char *s1, const char *s2);
+extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
+extern unsigned char pg_toupper(unsigned char ch);
+extern unsigned char pg_tolower(unsigned char ch);
+
/* Portable prompt handling */
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
extern int inet_aton(const char *cp, struct in_addr * addr);
#endif
-#ifndef HAVE_STRCASECMP
-extern int strcasecmp(char *s1, char *s2);
-#endif
-
#ifndef HAVE_STRDUP
extern char *strdup(char const *);
#endif
extern long random(void);
#endif
+#ifndef HAVE_UNSETENV
+extern void unsetenv(const char *name);
+#endif
+
#ifndef HAVE_SRANDOM
extern void srandom(unsigned int seed);
#endif
#undef HAVE_GETRUSAGE
-#define strncasecmp strnicmp
-
typedef u_short ushort;
extern int isnan(double dsrc);
#include <sys/types.h> /* Declare various types, e.g. size_t,
* fd_set */
-extern int strcasecmp(const char *, const char *);
-extern void bzero(void *, size_t);
-
extern int fp_class_d(double);
extern long random(void);
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/include/regex/regcustom.h,v 1.3 2003/11/29 22:41:10 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/regex/regcustom.h,v 1.4 2004/05/07 00:24:58 tgl Exp $
*/
/* headers if any */
#define CHR_MAX 0xfffffffe /* CHR_MAX-CHR_MIN+1 should fit in uchr */
/* functions operating on chr */
-#define iscalnum(x) pg_isalnum(x)
-#define iscalpha(x) pg_isalpha(x)
-#define iscdigit(x) pg_isdigit(x)
-#define iscspace(x) pg_isspace(x)
+#define iscalnum(x) pg_wc_isalnum(x)
+#define iscalpha(x) pg_wc_isalpha(x)
+#define iscdigit(x) pg_wc_isdigit(x)
+#define iscspace(x) pg_wc_isspace(x)
/* and pick up the standard header */
#include "regex.h"
/* convert the whole string to lower case */
for (i = 0; str_copy[i]; i++)
- str_copy[i] = (char) tolower((unsigned char) str_copy[i]);
+ str_copy[i] = (char) pg_tolower((unsigned char) str_copy[i]);
}
/* look for numerical tokens */
{
for (j = 0; j < PGTYPES_DATE_MONTH_MAXLENGTH; j++)
{
- month_lower_tmp[j] = (char) tolower((unsigned char) list[i][j]);
+ month_lower_tmp[j] = (char) pg_tolower((unsigned char) list[i][j]);
if (!month_lower_tmp[j])
{
/* properly terminated */
{
ftype[nf] = DTK_DATE;
while (isalnum((unsigned char) *(*endstr)) || (*(*endstr) == *dp))
- *lp++ = tolower((unsigned char) *(*endstr)++);
+ *lp++ = pg_tolower((unsigned char) *(*endstr)++);
}
}
else if (isalpha((unsigned char) *(*endstr)))
{
ftype[nf] = DTK_STRING;
- *lp++ = tolower((unsigned char) *(*endstr)++);
+ *lp++ = pg_tolower((unsigned char) *(*endstr)++);
while (isalpha((unsigned char) *(*endstr)))
- *lp++ = tolower((unsigned char) *(*endstr)++);
+ *lp++ = pg_tolower((unsigned char) *(*endstr)++);
/*
* Full date string with leading text month? Could also be a
else if (isalpha((unsigned char) *(*endstr)))
{
ftype[nf] = DTK_SPECIAL;
- *lp++ = tolower((unsigned char) *(*endstr)++);
+ *lp++ = pg_tolower((unsigned char) *(*endstr)++);
while (isalpha((unsigned char) *(*endstr)))
- *lp++ = tolower((unsigned char) *(*endstr)++);
+ *lp++ = pg_tolower((unsigned char) *(*endstr)++);
}
/* otherwise something wrong... */
else
*/
for (j = 0; !err && j < szdatetktbl; j++)
{
- if (strcasecmp(datetktbl[j].token, scan_val.str_val) == 0)
+ if (pg_strcasecmp(datetktbl[j].token, scan_val.str_val) == 0)
{
/*
* tz calculates the offset for the seconds, the
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.279 2004/05/05 15:03:04 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.280 2004/05/07 00:24:59 tgl Exp $ */
/* Copyright comment */
%{
/* Informix also has a CLOSE DATABASE command that
essantially works like a DISCONNECT CURRENT
as far as I know. */
- if (strcasecmp($1+strlen("close "), "database") == 0)
+ if (pg_strcasecmp($1+strlen("close "), "database") == 0)
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for close database statement.\n");
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.103 2004/04/25 20:57:32 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.104 2004/05/07 00:24:59 tgl Exp $
#
#-------------------------------------------------------------------------
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
dllist.o md5.o ip.o wchar.o encnames.o \
- $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS))
+ $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o pgstrcasecmp.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS))
ifeq ($(PORTNAME), win32)
OBJS+=win32.o
endif
# For port modules, this only happens if configure decides the module
# is needed (see filter hack in OBJS, above).
-crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/%
+crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/%
rm -f $@ && $(LN_S) $< .
md5.c ip.c: % : $(backend_src)/libpq/%
rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h
clean distclean maintainer-clean: clean-lib
- rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
+ rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.158 2004/03/14 22:00:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.159 2004/05/07 00:24:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- if (isupper((unsigned char) c))
- c = tolower((unsigned char) c);
+ c = pg_tolower((unsigned char) c);
*optr++ = c;
}
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.10 2004/03/05 01:53:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.11 2004/05/07 00:24:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if ((val = getenv(conn->next_eo->envName)))
{
- if (strcasecmp(val, "default") == 0)
+ if (pg_strcasecmp(val, "default") == 0)
sprintf(setQuery, "SET %s = DEFAULT",
conn->next_eo->pgName);
else
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.12 2004/03/21 22:29:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.13 2004/05/07 00:24:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if ((val = getenv(next_eo->envName)) != NULL)
{
- if (strcasecmp(val, "default") != 0)
+ if (pg_strcasecmp(val, "default") != 0)
{
if (packet)
strcpy(packet + packet_len, next_eo->pgName);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.39 2004/03/27 03:08:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.40 2004/05/07 00:24:59 tgl Exp $
*
* NOTES
* The client *requires* a valid server certificate. Since
*/
for (s = h->h_aliases; *s != NULL; s++)
{
- if (strcasecmp(conn->peer_cn, *s) == 0)
+ if (pg_strcasecmp(conn->peer_cn, *s) == 0)
return 0;
}
#define __win32_h_included
/*
- * strcasecmp() is not in Windows, stricmp is, though
- */
-#define strcasecmp(a,b) stricmp(a,b)
-#define strncasecmp(a,b,c) _strnicmp(a,b,c)
-
-/*
- * Some other compat functions
+ * Some compatibility functions
*/
#ifdef __BORLANDC__
#define _timeb timeb
#define _ftime(a) ftime(a)
-#define _strnicmp(a,b,c) strnicmp(a,b,c)
#define _errno errno
#else
/* open provided elsewhere */
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.46 2004/04/01 21:28:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.47 2004/05/07 00:24:59 tgl Exp $
*
*********************************************************************
*/
elog(ERROR, "expected trigger to return None or a String");
srv = PyString_AsString(plrv);
- if (strcasecmp(srv, "SKIP") == 0)
+ if (pg_strcasecmp(srv, "SKIP") == 0)
rv = NULL;
- else if (strcasecmp(srv, "MODIFY") == 0)
+ else if (pg_strcasecmp(srv, "MODIFY") == 0)
{
TriggerData *tdata = (TriggerData *) fcinfo->context;
else
elog(WARNING, "ignoring modified tuple in DELETE trigger");
}
- else if (strcasecmp(srv, "OK"))
+ else if (pg_strcasecmp(srv, "OK") != 0)
{
/*
* hmmm, perhaps they only read the pltcl page, not a
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * pgstrcasecmp.c
+ * Portable SQL-like case-independent comparisons and conversions.
+ *
+ * SQL99 specifies Unicode-aware case normalization, which we don't yet
+ * have the infrastructure for. Instead we use tolower() to provide a
+ * locale-aware translation. However, there are some locales where this
+ * is not right either (eg, Turkish may do strange things with 'i' and
+ * 'I'). Our current compromise is to use tolower() for characters with
+ * the high bit set, and use an ASCII-only downcasing for 7-bit
+ * characters.
+ *
+ * NB: this code should match downcase_truncate_identifier() in scansup.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ *
+ * $PostgreSQL: pgsql/src/port/pgstrcasecmp.c,v 1.1 2004/05/07 00:24:59 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+
+
+/*
+ * Case-independent comparison of two null-terminated strings.
+ */
+int
+pg_strcasecmp(const char *s1, const char *s2)
+{
+ for (;;)
+ {
+ unsigned char ch1 = (unsigned char) *s1++;
+ unsigned char ch2 = (unsigned char) *s2++;
+
+ if (ch1 != ch2)
+ {
+ if (ch1 >= 'A' && ch1 <= 'Z')
+ ch1 += 'a' - 'A';
+ else if (ch1 >= 0x80 && isupper(ch1))
+ ch1 = tolower(ch1);
+
+ if (ch2 >= 'A' && ch2 <= 'Z')
+ ch2 += 'a' - 'A';
+ else if (ch2 >= 0x80 && isupper(ch2))
+ ch2 = tolower(ch2);
+
+ if (ch1 != ch2)
+ return (int) ch1 - (int) ch2;
+ }
+ if (ch1 == 0)
+ break;
+ }
+ return 0;
+}
+
+/*
+ * Case-independent comparison of two not-necessarily-null-terminated strings.
+ * At most n bytes will be examined from each string.
+ */
+int
+pg_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+ while (n-- > 0)
+ {
+ unsigned char ch1 = (unsigned char) *s1++;
+ unsigned char ch2 = (unsigned char) *s2++;
+
+ if (ch1 != ch2)
+ {
+ if (ch1 >= 'A' && ch1 <= 'Z')
+ ch1 += 'a' - 'A';
+ else if (ch1 >= 0x80 && isupper(ch1))
+ ch1 = tolower(ch1);
+
+ if (ch2 >= 'A' && ch2 <= 'Z')
+ ch2 += 'a' - 'A';
+ else if (ch2 >= 0x80 && isupper(ch2))
+ ch2 = tolower(ch2);
+
+ if (ch1 != ch2)
+ return (int) ch1 - (int) ch2;
+ }
+ if (ch1 == 0)
+ break;
+ }
+ return 0;
+}
+
+/*
+ * Fold a character to upper case.
+ *
+ * Unlike some versions of toupper(), this is safe to apply to characters
+ * that aren't upper case letters. Note however that the whole thing is
+ * a bit bogus for multibyte character sets.
+ */
+unsigned char
+pg_toupper(unsigned char ch)
+{
+ if (ch >= 'a' && ch <= 'z')
+ ch += 'A' - 'a';
+ else if (ch >= 0x80 && islower(ch))
+ ch = toupper(ch);
+ return ch;
+}
+
+/*
+ * Fold a character to lower case.
+ *
+ * Unlike some versions of tolower(), this is safe to apply to characters
+ * that aren't lower case letters. Note however that the whole thing is
+ * a bit bogus for multibyte character sets.
+ */
+unsigned char
+pg_tolower(unsigned char ch)
+{
+ if (ch >= 'A' && ch <= 'Z')
+ ch += 'a' - 'A';
+ else if (ch >= 0x80 && isupper(ch))
+ ch = tolower(ch);
+ return ch;
+}
+++ /dev/null
-/* $PostgreSQL: pgsql/src/port/strcasecmp.c,v 1.4 2003/11/29 22:41:31 pgsql Exp $ */
-
-/*
- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
- * Portions Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific written prior permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * This array is designed for mapping upper and lower case letter
- * together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
- */
-static unsigned char charmap[] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
-
-int
-strcasecmp(char *s1, char *s2)
-{
- unsigned char u1,
- u2;
-
- for (;;)
- {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (charmap[u1] != charmap[u2])
- return charmap[u1] - charmap[u2];
- if (u1 == '\0')
- return 0;
- }
-}