|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
* |
|
|
|
|
* Copyright 2000 by PostgreSQL Global Development Group |
|
|
|
|
* |
|
|
|
|
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.22 2000/02/20 14:28:20 petere Exp $ |
|
|
|
|
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.23 2000/02/21 02:05:12 ishii Exp $ |
|
|
|
|
*/ |
|
|
|
|
#include "postgres.h" |
|
|
|
|
#include "command.h" |
|
|
|
@ -354,28 +354,33 @@ exec_command(const char *cmd, |
|
|
|
|
fputs("\n", fout); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* \encoding -- set client side encoding */ |
|
|
|
|
/* \encoding -- set/show client side encoding */ |
|
|
|
|
else if (strcmp(cmd, "encoding") == 0) |
|
|
|
|
{ |
|
|
|
|
char *encoding = scan_option(&string, OT_NORMAL, NULL); |
|
|
|
|
|
|
|
|
|
if (!encoding) |
|
|
|
|
/* show encoding */ |
|
|
|
|
puts(pg_encoding_to_char(pset.encoding)); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#ifdef MULTIBYTE |
|
|
|
|
/* set encoding */ |
|
|
|
|
if (PQsetClientEncoding(pset.db, encoding) == -1) |
|
|
|
|
psql_error("%s: invalid encoding name\n", encoding); |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
/* save encoding info into psql internal data */ |
|
|
|
|
pset.encoding = PQclientEncoding(pset.db); |
|
|
|
|
SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding)); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
psql_error("\\%s: multi-byte support is not enabled\n", cmd); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
free(encoding); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* \f -- change field separator */ |
|
|
|
|
else if (strcmp(cmd, "f") == 0) |
|
|
|
|