mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~". Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape). Extend the definition to make the FOR clause optional. Define textregexsubstr() to actually implement this feature. Update the regression test to include these new string features. All tests pass. Rename the regular expression support routines from "pg95_xxx" to "pg_xxx". Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
This commit is contained in:
@ -174,9 +174,10 @@ static int never = 0; /* for use in asserts; shuts lint up */
|
||||
|
||||
/*
|
||||
* regcomp - interface for parser and compilation
|
||||
* returns 0 success, otherwise REG_something
|
||||
*/
|
||||
int /* 0 success, otherwise REG_something */
|
||||
pg95_regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||
int
|
||||
pg_regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||
{
|
||||
struct parse pa;
|
||||
struct re_guts *g;
|
||||
@ -224,7 +225,6 @@ pg95_regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||
(void) pg_mb2wchar((unsigned char *) pattern, wcp);
|
||||
len = pg_wchar_strlen(wcp);
|
||||
#else
|
||||
|
||||
len = strlen((char *) pattern);
|
||||
#endif
|
||||
}
|
||||
@ -305,7 +305,7 @@ pg95_regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||
|
||||
/* win or lose, we're done */
|
||||
if (p->error != 0) /* lose */
|
||||
pg95_regfree(preg);
|
||||
pg_regfree(preg);
|
||||
return p->error;
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,8 @@ static struct rerr
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
size_t
|
||||
pg95_regerror(int errcode, const regex_t *preg,
|
||||
char *errbuf, size_t errbuf_size)
|
||||
pg_regerror(int errcode, const regex_t *preg,
|
||||
char *errbuf, size_t errbuf_size)
|
||||
{
|
||||
struct rerr *r;
|
||||
size_t len;
|
||||
|
@ -149,8 +149,8 @@ do { \
|
||||
* when choosing which matcher to call.
|
||||
*/
|
||||
int /* 0 success, REG_NOMATCH failure */
|
||||
pg95_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t *pmatch, int eflags)
|
||||
pg_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t *pmatch, int eflags)
|
||||
{
|
||||
struct re_guts *g = preg->re_g;
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
* regfree - free everything
|
||||
*/
|
||||
void
|
||||
pg95_regfree(regex_t *preg)
|
||||
pg_regfree(regex_t *preg)
|
||||
{
|
||||
struct re_guts *g;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* a simple regexp debug program
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/regex/Attic/retest.c,v 1.4 1999/07/17 20:17:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/regex/Attic/retest.c,v 1.5 2002/06/11 15:41:37 thomas Exp $
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@ -22,7 +22,7 @@ main()
|
||||
if (p)
|
||||
*p = '\0';
|
||||
|
||||
sts = pg95_regcomp(&re, buf, 1);
|
||||
sts = pg_regcomp(&re, buf, 1);
|
||||
printf("regcomp: parses \"%s\" and returns %d\n", buf, sts);
|
||||
for (;;)
|
||||
{
|
||||
@ -33,7 +33,7 @@ main()
|
||||
if (p)
|
||||
*p = '\0';
|
||||
|
||||
sts = pg95_regexec(&re, buf, 0, 0, 0);
|
||||
sts = pg_regexec(&re, buf, 0, 0, 0);
|
||||
printf("regexec: returns %d\n", sts);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user