mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Add auto-size to screen to \d? commands. Use UNION to show all
\d? results in one query. Add \d? field search feature. Rename MB to MULTIBYTE.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.29 1998/06/16 07:29:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.30 1998/07/18 18:34:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <libpq/libpq.h>
|
||||
#include <utils/syscache.h>
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
#include <commands/variable.h>
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
Datum attr;
|
||||
bool isnull;
|
||||
Oid typoutput;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *p;
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
outputstr = fmgr(typoutput, attr,
|
||||
gettypelem(typeinfo->attrs[i]->atttypid),
|
||||
typeinfo->attrs[i]->atttypmod);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
p = pg_server_to_client(outputstr, strlen(outputstr));
|
||||
pq_putint(strlen(p) + VARHDRSZ, VARHDRSZ);
|
||||
pq_putnchar(p, strlen(p));
|
||||
@@ -281,7 +281,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
|
||||
/* variable length, assume a varlena structure */
|
||||
len = VARSIZE(attr) - VARHDRSZ;
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pq_putncharlen(VARDATA(attr), len);
|
||||
#else
|
||||
pq_putint(len, VARHDRSZ);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* conversion between client encoding and server internal encoding
|
||||
* (currently mule internal code (mic) is used)
|
||||
* Tatsuo Ishii
|
||||
* $Id: mbutils.c,v 1.1 1998/06/16 07:38:18 momjian Exp $
|
||||
* $Id: mbutils.c,v 1.2 1998/07/18 18:34:01 momjian Exp $
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "regex/pg_wchar.h"
|
||||
#include "commands/variable.h"
|
||||
|
||||
static int client_encoding = MB; /* defalut client encoding is set to
|
||||
static int client_encoding = MULTIBYTE; /* defalut client encoding is set to
|
||||
same as the server encoding */
|
||||
/*
|
||||
* convert bogus chars that cannot be represented in the current encoding
|
||||
@@ -381,10 +381,10 @@ int pg_set_client_encoding(int encoding)
|
||||
{
|
||||
client_encoding = encoding;
|
||||
|
||||
if (client_encoding == MB) { /* server == client? */
|
||||
if (client_encoding == MULTIBYTE) { /* server == client? */
|
||||
client_to_mic = client_from_mic = 0;
|
||||
server_to_mic = server_from_mic = 0;
|
||||
} else if (MB == MULE_INTERNAL) { /* server == MULE_INETRNAL? */
|
||||
} else if (MULTIBYTE == MULE_INTERNAL) { /* server == MULE_INETRNAL? */
|
||||
client_to_mic = get_enc_ent(encoding)->to_mic;
|
||||
client_from_mic = get_enc_ent(encoding)->from_mic;
|
||||
server_to_mic = server_from_mic = 0;
|
||||
@@ -393,16 +393,16 @@ int pg_set_client_encoding(int encoding)
|
||||
}
|
||||
} else if (encoding == MULE_INTERNAL) { /* client == MULE_INETRNAL? */
|
||||
client_to_mic = client_from_mic = 0;
|
||||
server_to_mic = get_enc_ent(MB)->to_mic;
|
||||
server_from_mic = get_enc_ent(MB)->from_mic;
|
||||
server_to_mic = get_enc_ent(MULTIBYTE)->to_mic;
|
||||
server_from_mic = get_enc_ent(MULTIBYTE)->from_mic;
|
||||
if (server_to_mic == 0 || server_from_mic == 0) {
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
client_to_mic = get_enc_ent(encoding)->to_mic;
|
||||
client_from_mic = get_enc_ent(encoding)->from_mic;
|
||||
server_to_mic = get_enc_ent(MB)->to_mic;
|
||||
server_from_mic = get_enc_ent(MB)->from_mic;
|
||||
server_to_mic = get_enc_ent(MULTIBYTE)->to_mic;
|
||||
server_from_mic = get_enc_ent(MULTIBYTE)->from_mic;
|
||||
if (client_to_mic == 0 || client_from_mic == 0) {
|
||||
return(-1);
|
||||
}
|
||||
@@ -504,7 +504,7 @@ const char *pg_encoding_to_char(int encoding)
|
||||
return(p->name);
|
||||
}
|
||||
|
||||
#ifdef MBUTILSDEBUG
|
||||
#ifdef MULTIBYTEUTILSDEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Routines for handling of 'SET var TO',
|
||||
* 'SHOW var' and 'RESET var' statements.
|
||||
*
|
||||
* $Id: variable.c,v 1.7 1998/06/16 07:29:21 momjian Exp $
|
||||
* $Id: variable.c,v 1.8 1998/07/18 18:34:01 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "commands/variable.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "optimizer/internal.h"
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
#include "regex/pg_wchar.h"
|
||||
#endif
|
||||
|
||||
@@ -522,7 +522,7 @@ reset_timezone()
|
||||
return TRUE;
|
||||
} /* reset_timezone() */
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
/*-----------------------------------------------------------------------*/
|
||||
bool
|
||||
parse_client_encoding(const char *value)
|
||||
@@ -535,7 +535,7 @@ parse_client_encoding(const char *value)
|
||||
} else {
|
||||
if (pg_set_client_encoding(encoding)) {
|
||||
elog(ERROR, "Conversion between %s and %s is not supported",
|
||||
value, pg_encoding_to_char(MB));
|
||||
value, pg_encoding_to_char(MULTIBYTE));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@@ -558,10 +558,10 @@ reset_client_encoding()
|
||||
if (env) {
|
||||
encoding = pg_char_to_encoding(env);
|
||||
if (encoding < 0) {
|
||||
encoding = MB;
|
||||
encoding = MULTIBYTE;
|
||||
}
|
||||
} else {
|
||||
encoding = MB;
|
||||
encoding = MULTIBYTE;
|
||||
}
|
||||
pg_set_client_encoding(encoding);
|
||||
return TRUE;
|
||||
@@ -598,7 +598,7 @@ struct VariableParsers
|
||||
{
|
||||
"r_plans", parse_r_plans, show_r_plans, reset_r_plans
|
||||
},
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
{
|
||||
"client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.48 1998/07/09 03:28:46 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.49 1998/07/18 18:34:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -67,7 +67,7 @@
|
||||
#include "libpq/auth.h"
|
||||
#include "libpq/libpq.h" /* where the declarations go */
|
||||
#include "storage/ipc.h"
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
#include "commands/variable.h"
|
||||
#endif
|
||||
|
||||
@@ -181,7 +181,7 @@ pq_getstr(char *s, int maxlen)
|
||||
{
|
||||
int c = '\0';
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *p, *ps;
|
||||
int len;
|
||||
|
||||
@@ -199,7 +199,7 @@ pq_getstr(char *s, int maxlen)
|
||||
*s++ = c;
|
||||
*s = '\0';
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
p = pg_client_to_server(ps, len);
|
||||
if (ps != p) { /* actual conversion has been done? */
|
||||
strcpy(ps, p);
|
||||
@@ -341,7 +341,7 @@ pq_getint(int b)
|
||||
void
|
||||
pq_putstr(char *s)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *p;
|
||||
|
||||
p = pg_server_to_client(s, strlen(s));
|
||||
@@ -740,7 +740,7 @@ StreamOpen(char *hostName, short portName, Port *port)
|
||||
return (STATUS_OK);
|
||||
}
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
void
|
||||
pq_putncharlen(char *s, int n)
|
||||
{
|
||||
|
||||
@@ -117,14 +117,14 @@ extern "C"
|
||||
#define EOW (BOL+5)
|
||||
#define CODEMAX (BOL+5) /* highest code used */
|
||||
|
||||
#ifdef MB
|
||||
# if MB == MULE_INTERNAL
|
||||
#ifdef MULTIBYTE
|
||||
# if MULTIBYTE == MULE_INTERNAL
|
||||
# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
|
||||
# define NNONCHAR (CODEMAX-16777216)
|
||||
# elif MB == EUC_JP || MB == EUC_CN || MB == EUC_KR || MB == EUC_TW
|
||||
# elif MULTIBYTE == EUC_JP || MULTIBYTE == EUC_CN || MULTIBYTE == EUC_KR || MULTIBYTE == EUC_TW
|
||||
# define NONCHAR(c) ((c) > USHRT_MAX)
|
||||
# define NNONCHAR (CODEMAX-USHRT_MAX)
|
||||
# elif MB == UNICODE
|
||||
# elif MULTIBYTE == UNICODE
|
||||
# define NONCHAR(c) ((c) > USHRT_MAX)
|
||||
# define NNONCHAR (CODEMAX-USHRT_MAX)
|
||||
# else /* assume 1 byte code such as ISO8859-1 */
|
||||
@@ -200,7 +200,7 @@ int eflags;
|
||||
else
|
||||
{
|
||||
start = string;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
stop = start + pg_wchar_strlen(start);
|
||||
#else
|
||||
stop = start + strlen(start);
|
||||
@@ -214,7 +214,7 @@ int eflags;
|
||||
{
|
||||
for (dp = start; dp < stop; dp++)
|
||||
if (*dp == g->must[0] && stop - dp >= g->mlen &&
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0)
|
||||
#else
|
||||
memcmp(dp, g->must, (size_t) g->mlen) == 0)
|
||||
@@ -1165,7 +1165,7 @@ sopno stopst;
|
||||
|
||||
static int pg_isprint(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isprint(c));
|
||||
#else
|
||||
return(isprint(c));
|
||||
|
||||
@@ -194,7 +194,7 @@ int cflags;
|
||||
struct parse *p = &pa;
|
||||
int i;
|
||||
size_t len;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *wcp;
|
||||
#endif
|
||||
|
||||
@@ -210,7 +210,7 @@ int cflags;
|
||||
|
||||
if (cflags & REG_PEND)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
wcp = preg->patsave;
|
||||
if (preg->re_endp < wcp)
|
||||
return (REG_INVARG);
|
||||
@@ -222,7 +222,7 @@ int cflags;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar));
|
||||
if (wcp == NULL) {
|
||||
return (REG_ESPACE);
|
||||
@@ -253,7 +253,7 @@ int cflags;
|
||||
|
||||
/* set things up */
|
||||
p->g = g;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
p->next = wcp;
|
||||
#else
|
||||
p->next = (pg_wchar *)pattern; /* convenience; we do not modify it */
|
||||
@@ -607,7 +607,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
if (c == '\\')
|
||||
{
|
||||
REQUIRE(MORE(), REG_EESCAPE);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
c = BACKSL | (pg_wchar) GETNEXT();
|
||||
#else
|
||||
c = BACKSL | (unsigned char) GETNEXT();
|
||||
@@ -755,13 +755,13 @@ struct parse *p;
|
||||
{
|
||||
cset *cs = allocset(p);
|
||||
int invert = 0;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
|
||||
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
|
||||
#endif
|
||||
|
||||
/* Dept of Truly Sickening Special-Case Kludges */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
|
||||
@@ -771,7 +771,7 @@ struct parse *p;
|
||||
NEXTn(6);
|
||||
return;
|
||||
}
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0)
|
||||
@@ -903,7 +903,7 @@ cset *cs;
|
||||
finish = start;
|
||||
/* xxx what about signed chars here... */
|
||||
REQUIRE(start <= finish, REG_ERANGE);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (CHlc(start) != CHlc(finish)) {
|
||||
SETERROR(REG_ERANGE);
|
||||
}
|
||||
@@ -933,7 +933,7 @@ cset *cs;
|
||||
NEXT();
|
||||
len = p->next - sp;
|
||||
for (cp = cclasses; cp->name != NULL; cp++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
#else
|
||||
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
@@ -1012,7 +1012,7 @@ int endc; /* name ended by endc,']' */
|
||||
}
|
||||
len = p->next - sp;
|
||||
for (cp = cnames; cp->name != NULL; cp++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
#else
|
||||
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
|
||||
@@ -1084,7 +1084,7 @@ int ch;
|
||||
bothcases(p, ch);
|
||||
else
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
EMIT(OCHAR, (pg_wchar) ch);
|
||||
#else
|
||||
EMIT(OCHAR, (unsigned char) ch);
|
||||
@@ -1788,7 +1788,7 @@ struct re_guts *g;
|
||||
return;
|
||||
|
||||
/* turn it into a character string */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
g->must = (pg_wchar *)malloc((size_t) (g->mlen + 1)*sizeof(pg_wchar));
|
||||
#else
|
||||
g->must = malloc((size_t) g->mlen + 1);
|
||||
@@ -1854,7 +1854,7 @@ struct re_guts *g;
|
||||
*/
|
||||
static int pg_isdigit(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isdigit(c));
|
||||
#else
|
||||
return(isdigit(c));
|
||||
@@ -1863,7 +1863,7 @@ static int pg_isdigit(int c)
|
||||
|
||||
static int pg_isalpha(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isalpha(c));
|
||||
#else
|
||||
return(isalpha(c));
|
||||
@@ -1872,7 +1872,7 @@ static int pg_isalpha(int c)
|
||||
|
||||
static int pg_isupper(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isupper(c));
|
||||
#else
|
||||
return(isupper(c));
|
||||
@@ -1881,7 +1881,7 @@ static int pg_isupper(int c)
|
||||
|
||||
static int pg_islower(int c)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && islower(c));
|
||||
#else
|
||||
return(islower(c));
|
||||
|
||||
@@ -215,7 +215,7 @@ char *localbuf;
|
||||
struct rerr *r;
|
||||
|
||||
for (r = rerrs; r->code != 0; r++)
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (pg_char_and_wchar_strcmp(r->name, preg->re_endp) == 0)
|
||||
#else
|
||||
if (strcmp(r->name, preg->re_endp) == 0)
|
||||
|
||||
@@ -164,7 +164,7 @@ int eflags;
|
||||
{
|
||||
struct re_guts *g = preg->re_g;
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *str;
|
||||
int sts;
|
||||
#endif
|
||||
@@ -182,7 +182,7 @@ int eflags;
|
||||
return (REG_BADPAT);
|
||||
eflags = GOODFLAGS(eflags);
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
str = (pg_wchar *)malloc((strlen(string)+1) * sizeof(pg_wchar));
|
||||
if (!str) {
|
||||
return(REG_ESPACE);
|
||||
|
||||
@@ -68,7 +68,7 @@ regex_t *preg;
|
||||
return;
|
||||
preg->re_magic = 0; /* mark it invalid */
|
||||
g->magic = 0; /* mark it invalid */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if (preg->patsave != NULL) {
|
||||
free((char *)preg->patsave);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* misc conversion functions between pg_wchar and other encodings.
|
||||
* Tatsuo Ishii
|
||||
* $Id: utils.c,v 1.3 1998/06/16 07:29:29 momjian Exp $
|
||||
* $Id: utils.c,v 1.4 1998/07/18 18:34:08 momjian Exp $
|
||||
*/
|
||||
#include <regex/pg_wchar.h>
|
||||
|
||||
@@ -350,19 +350,19 @@ static pg_wchar_tbl pg_wchar_table[] = {
|
||||
/* convert a multi-byte string to a wchar */
|
||||
void pg_mb2wchar(const unsigned char *from, pg_wchar *to)
|
||||
{
|
||||
(*pg_wchar_table[MB].mb2wchar_with_len)(from,to,strlen(from));
|
||||
(*pg_wchar_table[MULTIBYTE].mb2wchar_with_len)(from,to,strlen(from));
|
||||
}
|
||||
|
||||
/* convert a multi-byte string to a wchar with a limited length */
|
||||
void pg_mb2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
|
||||
{
|
||||
(*pg_wchar_table[MB].mb2wchar_with_len)(from,to,len);
|
||||
(*pg_wchar_table[MULTIBYTE].mb2wchar_with_len)(from,to,len);
|
||||
}
|
||||
|
||||
/* returns the byte length of a multi-byte word */
|
||||
int pg_mblen(const unsigned char *mbstr)
|
||||
{
|
||||
return((*pg_wchar_table[MB].mblen)(mbstr));
|
||||
return((*pg_wchar_table[MULTIBYTE].mblen)(mbstr));
|
||||
}
|
||||
|
||||
/* returns the byte length of a multi-byte word for an encoding */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.79 1998/07/09 03:28:48 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.80 1998/07/18 18:34:09 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -83,7 +83,7 @@
|
||||
#include "nodes/memnodes.h"
|
||||
#endif
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
#include "commands/variable.h"
|
||||
#endif
|
||||
|
||||
@@ -1270,7 +1270,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
|
||||
InitPostgres(DBName);
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
/* set default client encoding */
|
||||
if (!Quiet)
|
||||
{
|
||||
@@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface");
|
||||
puts("$Revision: 1.79 $ $Date: 1998/07/09 03:28:48 $");
|
||||
puts("$Revision: 1.80 $ $Date: 1998/07/18 18:34:09 $");
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
|
||||
@@ -49,7 +49,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
|
||||
return FALSE;
|
||||
|
||||
/* be sure sterm is null-terminated */
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
sterm = (pg_wchar *) palloc((charlen + 1)*sizeof(pg_wchar));
|
||||
(void)pg_mb2wchar_with_len((unsigned char *)s,sterm,charlen);
|
||||
#else
|
||||
@@ -64,7 +64,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
|
||||
|
||||
/* palloc the length of the text + the null character */
|
||||
len = VARSIZE(p) - VARHDRSZ;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pterm = (pg_wchar *) palloc((len + 1)*sizeof(pg_wchar));
|
||||
(void)pg_mb2wchar_with_len((unsigned char *)VARDATA(p),pterm,len);
|
||||
#else
|
||||
@@ -111,7 +111,7 @@ textnlike(struct varlena * s, struct varlena * p)
|
||||
}
|
||||
|
||||
|
||||
/* $Revision: 1.16 $
|
||||
/* $Revision: 1.17 $
|
||||
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
||||
**
|
||||
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.35 1998/07/12 21:29:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.36 1998/07/18 18:34:12 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -398,13 +398,13 @@ bcTruelen(char *arg)
|
||||
int32
|
||||
bpcharlen(char *arg)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *s;
|
||||
int len, l, wl;
|
||||
#endif
|
||||
if (!PointerIsValid(arg))
|
||||
elog(ERROR, "Bad (null) char() external representation", NULL);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
l = bcTruelen(arg);
|
||||
len = 0;
|
||||
s = VARDATA(arg);
|
||||
@@ -563,14 +563,14 @@ bpcharcmp(char *arg1, char *arg2)
|
||||
int32
|
||||
varcharlen(char *arg)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *s;
|
||||
int len, l, wl;
|
||||
#endif
|
||||
if (!PointerIsValid(arg))
|
||||
elog(ERROR, "Bad (null) varchar() external representation", NULL);
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
len = 0;
|
||||
s = VARDATA(arg);
|
||||
l = VARSIZE(arg) - VARHDRSZ;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.37 1998/06/16 06:41:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.38 1998/07/18 18:34:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -206,7 +206,7 @@ textout(text *vlena)
|
||||
int32
|
||||
textlen(text *t)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *s;
|
||||
int len, l, wl;
|
||||
#endif
|
||||
@@ -214,7 +214,7 @@ textlen(text *t)
|
||||
if (!PointerIsValid(t))
|
||||
elog(ERROR, "Null input to textlen");
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
len = 0;
|
||||
s = VARDATA(t);
|
||||
l = VARSIZE(t) - VARHDRSZ;
|
||||
@@ -322,7 +322,7 @@ text_substr(text *string, int32 m, int32 n)
|
||||
{
|
||||
text *ret;
|
||||
int len;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
int i;
|
||||
char *p;
|
||||
#endif
|
||||
@@ -331,7 +331,7 @@ text_substr(text *string, int32 m, int32 n)
|
||||
return string;
|
||||
|
||||
len = VARSIZE(string) - VARHDRSZ;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
len = pg_mbstrlen_with_len(VARDATA(string),len);
|
||||
#endif
|
||||
|
||||
@@ -348,7 +348,7 @@ text_substr(text *string, int32 m, int32 n)
|
||||
n = (len - m);
|
||||
}
|
||||
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
p = VARDATA(string);
|
||||
for (i=0;i<m;i++) {
|
||||
p += pg_mblen(p);
|
||||
@@ -387,7 +387,7 @@ textpos(text *t1, text *t2)
|
||||
len2;
|
||||
pg_wchar *p1,
|
||||
*p2;
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *ps1, *ps2;
|
||||
#endif
|
||||
|
||||
@@ -399,7 +399,7 @@ textpos(text *t1, text *t2)
|
||||
|
||||
len1 = (VARSIZE(t1) - VARHDRSZ);
|
||||
len2 = (VARSIZE(t2) - VARHDRSZ);
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
ps1 = p1 = (pg_wchar *) palloc((len1 + 1)*sizeof(pg_wchar));
|
||||
(void)pg_mb2wchar_with_len((unsigned char *)VARDATA(t1),p1,len1);
|
||||
len1 = pg_wchar_strlen(p1);
|
||||
@@ -414,7 +414,7 @@ textpos(text *t1, text *t2)
|
||||
px = (len1 - len2);
|
||||
for (p = 0; p <= px; p++)
|
||||
{
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
if ((*p2 == *p1) && (pg_wchar_strncmp(p1, p2, len2) == 0))
|
||||
#else
|
||||
if ((*p2 == *p1) && (strncmp(p1, p2, len2) == 0))
|
||||
@@ -425,7 +425,7 @@ textpos(text *t1, text *t2)
|
||||
};
|
||||
p1++;
|
||||
};
|
||||
#ifdef MB
|
||||
#ifdef MULTIBYTE
|
||||
pfree(ps1);
|
||||
pfree(ps2);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user