1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

A few minor psql enhancements

Initdb help correction
Changed end/abort to commit/rollback and changed related notices
Commented out way old printing functions in libpq
Fixed a typo in alter table / alter column
This commit is contained in:
Peter Eisentraut
2000-01-29 16:58:54 +00:00
parent 7e7416bd4e
commit 2b84cbb60f
49 changed files with 821 additions and 870 deletions

View File

@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.37 2000/01/26 05:58:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.38 2000/01/29 16:58:51 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -51,6 +51,11 @@
#include "libpq-int.h"
#include "pqsignal.h"
#ifdef MULTIBYTE
#include "miscadmin.h"
#include "mb/pg_wchar.h"
#endif
#define DONOTICE(conn,message) \
((*(conn)->noticeHook) ((conn)->noticeArg, (message)))
@ -737,3 +742,52 @@ pqWait(int forRead, int forWrite, PGconn *conn)
return 0;
}
/*
* A couple of "miscellaneous" multibyte related functions. They used
* to be in fe-print.c but that file is doomed.
*/
#ifdef MULTIBYTE
/*
* returns the byte length of the word beginning s, using the
* specified encoding.
*/
int
PQmblen(const unsigned char *s, int encoding)
{
return (pg_encoding_mblen(encoding, s));
}
/*
* Get encoding id from environment variable PGCLIENTENCODING.
*/
int
PQenv2encoding(void)
{
char *str;
int encoding = SQL_ASCII;
str = getenv("PGCLIENTENCODING");
if (str && *str != '\0')
encoding = pg_char_to_encoding(str);
return(encoding);
}
#else
/* Provide a default definition in case someone calls it anyway */
int
PQmblen(const unsigned char *s, int encoding)
{
return 1;
}
int
PQenv2encoding(void)
{
return 0;
}
#endif /* MULTIBYTE */