Commit 5ab40f0b authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Reimplement MULTIBYTE support (oops). Not tested, but it does compile.

parent 62e29fe2
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.39 2000/08/07 01:45:00 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.40 2000/08/09 14:13:03 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -37,101 +37,321 @@ static int MatchTextLower(pg_wchar * t, int tlen, pg_wchar * p, int plen, char * ...@@ -37,101 +37,321 @@ static int MatchTextLower(pg_wchar * t, int tlen, pg_wchar * p, int plen, char *
Datum Datum
namelike(PG_FUNCTION_ARGS) namelike(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); Name str = PG_GETARG_NAME(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchText(NameStr(*n), strlen(NameStr(*n)), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
NULL)
== LIKE_TRUE); #ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = strlen(NameStr(*str));
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) NameStr(*str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchText(s, slen, p, plen, "\\") == LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
namenlike(PG_FUNCTION_ARGS) namenlike(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); Name str = PG_GETARG_NAME(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchText(NameStr(*n), strlen(NameStr(*n)), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
NULL)
!= LIKE_TRUE); #ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = strlen(NameStr(*str));
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) NameStr(*str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchText(s, slen, p, plen, "\\") != LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
namelike_escape(PG_FUNCTION_ARGS) namelike_escape(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); Name str = PG_GETARG_NAME(0);
text *e = PG_GETARG_TEXT_P(2); text *pat = PG_GETARG_TEXT_P(1);
text *esc = PG_GETARG_TEXT_P(2);
PG_RETURN_BOOL(MatchText(NameStr(*n), strlen(NameStr(*n)), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) char *e;
== LIKE_TRUE);
#ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = strlen(NameStr(*str));
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) NameStr(*str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchText(s, slen, p, plen, e) == LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
namenlike_escape(PG_FUNCTION_ARGS) namenlike_escape(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); Name str = PG_GETARG_NAME(0);
text *e = PG_GETARG_TEXT_P(2); text *pat = PG_GETARG_TEXT_P(1);
text *esc = PG_GETARG_TEXT_P(2);
PG_RETURN_BOOL(MatchText(NameStr(*n), strlen(NameStr(*n)), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) char *e;
!= LIKE_TRUE);
#ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = strlen(NameStr(*str));
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) NameStr(*str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchText(s, slen, p, plen, e) != LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
textlike(PG_FUNCTION_ARGS) textlike(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); text *str = PG_GETARG_TEXT_P(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchText(VARDATA(s), (VARSIZE(s)-VARHDRSZ), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
NULL)
== LIKE_TRUE); #ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = (VARSIZE(str)-VARHDRSZ);
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchText(s, slen, p, plen, NULL) == LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
textnlike(PG_FUNCTION_ARGS) textnlike(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); text *str = PG_GETARG_TEXT_P(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchText(VARDATA(s), (VARSIZE(s)-VARHDRSZ), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
NULL)
!= LIKE_TRUE); #ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = (VARSIZE(str)-VARHDRSZ);
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchText(s, slen, p, plen, "\\") != LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
textlike_escape(PG_FUNCTION_ARGS) textlike_escape(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); text *str = PG_GETARG_TEXT_P(0);
text *e = PG_GETARG_TEXT_P(2); text *pat = PG_GETARG_TEXT_P(1);
text *esc = PG_GETARG_TEXT_P(2);
PG_RETURN_BOOL(MatchText(VARDATA(s), (VARSIZE(s)-VARHDRSZ), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) char *e;
== LIKE_TRUE);
#ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = (VARSIZE(str)-VARHDRSZ);
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchText(s, slen, p, plen, e) == LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
Datum Datum
textnlike_escape(PG_FUNCTION_ARGS) textnlike_escape(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); text *str = PG_GETARG_TEXT_P(0);
text *e = PG_GETARG_TEXT_P(2); text *pat = PG_GETARG_TEXT_P(1);
text *esc = PG_GETARG_TEXT_P(2);
PG_RETURN_BOOL(MatchText(VARDATA(s), (VARSIZE(s)-VARHDRSZ), pg_wchar *s, *p;
VARDATA(p), (VARSIZE(p)-VARHDRSZ), int slen, plen;
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) char *e;
!= LIKE_TRUE);
#ifdef MULTIBYTE
pg_wchar *ss, *pp;
slen = (VARSIZE(str)-VARHDRSZ);
s = (pg_wchar *) palloc((slen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(str), s, slen);
for (ss = s, slen = 0; *ss != 0; ss++) slen++;
plen = (VARSIZE(pat)-VARHDRSZ);
p = (pg_wchar *) palloc((plen+1) * sizeof(pg_wchar));
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(pat), p, plen);
for (pp = p, plen = 0; *pp != 0; pp++) plen++;
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchText(s, slen, p, plen, e) != LIKE_TRUE);
#ifdef MULTIBYTE
pfree(s);
pfree(p);
#endif
PG_RETURN_BOOL(result);
} }
/* /*
...@@ -141,101 +361,217 @@ textnlike_escape(PG_FUNCTION_ARGS) ...@@ -141,101 +361,217 @@ textnlike_escape(PG_FUNCTION_ARGS)
Datum Datum
inamelike(PG_FUNCTION_ARGS) inamelike(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
Name str = PG_GETARG_NAME(0);
PG_RETURN_BOOL(MatchTextLower(NameStr(*n), strlen(NameStr(*n)), text *pat = PG_GETARG_TEXT_P(1);
VARDATA(p), (VARSIZE(p)-VARHDRSZ), #endif
NULL) pg_wchar *s, *p;
== LIKE_TRUE); int slen, plen;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchTextLower(s, slen, p, plen, "\\") == LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
inamenlike(PG_FUNCTION_ARGS) inamenlike(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
Name str = PG_GETARG_NAME(0);
PG_RETURN_BOOL(MatchTextLower(NameStr(*n), strlen(NameStr(*n)), text *pat = PG_GETARG_TEXT_P(1);
VARDATA(p), (VARSIZE(p)-VARHDRSZ), #endif
NULL) pg_wchar *s, *p;
!= LIKE_TRUE); int slen, plen;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchTextLower(s, slen, p, plen, "\\") != LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
inamelike_escape(PG_FUNCTION_ARGS) inamelike_escape(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *e = PG_GETARG_TEXT_P(2); Name str = PG_GETARG_NAME(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchTextLower(NameStr(*n), strlen(NameStr(*n)), #endif
VARDATA(p), (VARSIZE(p)-VARHDRSZ), text *esc = PG_GETARG_TEXT_P(2);
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) pg_wchar *s, *p;
== LIKE_TRUE); int slen, plen;
char *e;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchTextLower(s, slen, p, plen, e) == LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
inamenlike_escape(PG_FUNCTION_ARGS) inamenlike_escape(PG_FUNCTION_ARGS)
{ {
Name n = PG_GETARG_NAME(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *e = PG_GETARG_TEXT_P(2); Name str = PG_GETARG_NAME(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchTextLower(NameStr(*n), strlen(NameStr(*n)), #endif
VARDATA(p), (VARSIZE(p)-VARHDRSZ), text *esc = PG_GETARG_TEXT_P(2);
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) pg_wchar *s, *p;
!= LIKE_TRUE); int slen, plen;
char *e;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = NameStr(*str);
slen = strlen(s);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchTextLower(s, slen, p, plen, e) != LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
itextlike(PG_FUNCTION_ARGS) itextlike(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *str = PG_GETARG_TEXT_P(0);
PG_RETURN_BOOL(MatchTextLower(VARDATA(s), (VARSIZE(s)-VARHDRSZ), text *pat = PG_GETARG_TEXT_P(1);
VARDATA(p), (VARSIZE(p)-VARHDRSZ), #endif
NULL) pg_wchar *s, *p;
== LIKE_TRUE); int slen, plen;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchTextLower(s, slen, p, plen, "\\") == LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
itextnlike(PG_FUNCTION_ARGS) itextnlike(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *str = PG_GETARG_TEXT_P(0);
PG_RETURN_BOOL(MatchTextLower(VARDATA(s), (VARSIZE(s)-VARHDRSZ), text *pat = PG_GETARG_TEXT_P(1);
VARDATA(p), (VARSIZE(p)-VARHDRSZ), #endif
NULL) pg_wchar *s, *p;
!= LIKE_TRUE); int slen, plen;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
result = (MatchTextLower(s, slen, p, plen, "\\") != LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
itextlike_escape(PG_FUNCTION_ARGS) itextlike_escape(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *e = PG_GETARG_TEXT_P(2); text *str = PG_GETARG_TEXT_P(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchTextLower(VARDATA(s), (VARSIZE(s)-VARHDRSZ), #endif
VARDATA(p), (VARSIZE(p)-VARHDRSZ), text *esc = PG_GETARG_TEXT_P(2);
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) pg_wchar *s, *p;
== LIKE_TRUE); int slen, plen;
char *e;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchTextLower(s, slen, p, plen, e) == LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
Datum Datum
itextnlike_escape(PG_FUNCTION_ARGS) itextnlike_escape(PG_FUNCTION_ARGS)
{ {
text *s = PG_GETARG_TEXT_P(0); bool result;
text *p = PG_GETARG_TEXT_P(1); #ifndef MULTIBYTE
text *e = PG_GETARG_TEXT_P(2); text *str = PG_GETARG_TEXT_P(0);
text *pat = PG_GETARG_TEXT_P(1);
PG_RETURN_BOOL(MatchTextLower(VARDATA(s), (VARSIZE(s)-VARHDRSZ), #endif
VARDATA(p), (VARSIZE(p)-VARHDRSZ), text *esc = PG_GETARG_TEXT_P(2);
((VARSIZE(e)-VARHDRSZ) > 0? VARDATA(e): NULL)) pg_wchar *s, *p;
!= LIKE_TRUE); int slen, plen;
char *e;
#ifdef MULTIBYTE
elog(ERROR, "Case-insensitive multi-byte comparisons are not yet supported");
#else
s = VARDATA(str);
slen = (VARSIZE(str)-VARHDRSZ);
p = VARDATA(pat);
plen = (VARSIZE(pat)-VARHDRSZ);
#endif
e = ((VARSIZE(esc)-VARHDRSZ) > 0? VARDATA(esc): NULL);
result = (MatchTextLower(s, slen, p, plen, e) != LIKE_TRUE);
PG_RETURN_BOOL(result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment