Commit 1a17447b authored by Peter Eisentraut's avatar Peter Eisentraut

NLS for libpq. Clean up the message formats and change the documentation

accordingly.
parent 9e5ec3b0
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.56 2001/06/10 03:46:31 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.57 2001/07/15 13:45:03 petere Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -2349,7 +2349,7 @@ Field separator is "oo", ...@@ -2349,7 +2349,7 @@ Field separator is "oo",
<para> <para>
Pressing Control-C during a <quote>copy in</quote> (data sent to the Pressing Control-C during a <quote>copy in</quote> (data sent to the
server) doesn't show the most ideal of behaviors. If you get a message server) doesn't show the most ideal of behaviors. If you get a message
such as <quote>PQexec: you gotta get out of a COPY state yourself</quote>, such as <quote>COPY state must be terminated first</quote>,
simply reset the connection by entering <literal>\c - -</literal>. simply reset the connection by entering <literal>\c - -</literal>.
</para> </para>
</listitem> </listitem>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.72 2001/06/30 22:03:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.73 2001/07/15 13:45:03 petere Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -392,9 +392,9 @@ IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on ...@@ -392,9 +392,9 @@ IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on
<para> <para>
<screen> <screen>
PQconnectPoll() -- connect() failed: Connection refused psql: could not connect to server: Connection refused
Is the postmaster running (with -i) at 'server.joe.com' Is the server running on host server.joe.com and accepting
and accepting connections on TCP/IP port 5432? TCP/IP connections on port 5432?
</screen> </screen>
This is the generic <quote>I couldn't find a server to talk This is the generic <quote>I couldn't find a server to talk
to</quote> failure. It looks like the above when TCP/IP to</quote> failure. It looks like the above when TCP/IP
...@@ -407,9 +407,9 @@ PQconnectPoll() -- connect() failed: Connection refused ...@@ -407,9 +407,9 @@ PQconnectPoll() -- connect() failed: Connection refused
Alternatively, you'll get this when attempting Alternatively, you'll get this when attempting
Unix-socket communication to a local postmaster: Unix-socket communication to a local postmaster:
<screen> <screen>
connectDBstart() -- connect() failed: No such file or directory psql: could not connect to server: Connection refused
Is the postmaster running locally Is the server running locally and accepting
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'? connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
</screen> </screen>
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.15 2000/11/30 23:20:50 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.16 2001/07/15 13:45:03 petere Exp $
--> -->
<chapter id="start"> <chapter id="start">
...@@ -154,18 +154,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.15 2000/11/30 23:20:50 tgl E ...@@ -154,18 +154,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.15 2000/11/30 23:20:50 tgl E
<programlisting> <programlisting>
% psql template1 % psql template1
psql: connectDBStart() -- connect() failed: No such file or directory psql: could not connect to server: Connection refused
Is the postmaster running locally Is the server running locally and accepting
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'? connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
</programlisting> </programlisting>
or or
<programlisting> <programlisting>
% psql -h localhost template1 % psql -h localhost template1
psql: PQconnectPoll() -- connect() failed: Connection refused psql: could not connect to server: Connection refused
Is the postmaster running (with -i) at 'localhost' Is the server running on host localhost and accepting
and accepting connections on TCP/IP port 5432? TCP/IP connections on port 5432?
</programlisting> </programlisting>
it is usually because it is usually because
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.52 2001/05/11 01:46:33 momjian Exp $ # $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.53 2001/07/15 13:45:04 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -30,7 +30,7 @@ endif ...@@ -30,7 +30,7 @@ endif
# Add libraries that libpq depends (or might depend) on into the # Add libraries that libpq depends (or might depend) on into the
# shared library link. (The order in which you list them here doesn't # shared library link. (The order in which you list them here doesn't
# matter.) # matter.)
SHLIB_LINK += $(filter -L%, $(LDFLAGS)) $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv, $(LIBS)) SHLIB_LINK += $(filter -L%, $(LDFLAGS)) $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS))
all: all-lib all: all-lib
......
# German message translation file for libpq
# Peter Eisentraut <peter_e@gmx.net>, 2001.
#
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/de.po,v 1.1 2001/07/15 13:45:04 petere Exp $
#
# Use these quotes: %s
#
msgid ""
msgstr ""
"Project-Id-Version: PostgreSQL 7.2\n"
"POT-Creation-Date: 2001-07-15 14:41+0200\n"
"PO-Revision-Date: 2001-07-15 14:41+0200\n"
"Last-Translator: Peter Eisentraut <peter_e@gmx.net>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
#: fe-auth.c:222
#, c-format
msgid "Kerberos 4 error: %s\n"
msgstr "Kerberos-4-Fehler: %s\n"
#: fe-auth.c:387
#, c-format
msgid "could not set socket to blocking mode: %s"
msgstr "konnte Socket nicht auf blockierenden Modus umstellen: %s"
#: fe-auth.c:403
#, c-format
msgid "Kerberos 5 authentication rejected: %*s"
msgstr "Authentifizierung mit Kerberos 5 abgelehnt: %*s"
#: fe-auth.c:424
#, c-format
msgid "could not restore non-blocking mode on socket: %s"
msgstr ""
"konnte den nicht blockierenden Modus auf dem Socket nicht wieder herstellen: "
"%s"
#: fe-auth.c:468
msgid "Kerberos 4 authentication failed\n"
msgstr "Authentifizierung mit Kerberos 4 schlug fehl\n"
#: fe-auth.c:474
msgid "Kerberos 4 authentication not supported\n"
msgstr "Authentifizierung mit Kerberos 4 nicht untersttzt\n"
#: fe-auth.c:485
msgid "Kerberos 5 authentication failed\n"
msgstr "Authentifizierung mit Kerberos 5 schlug fehl\n"
#: fe-auth.c:491
msgid "Kerberos 5 authentication not supported\n"
msgstr "Authentifizierung mit Kerberos 5 nicht untersttzt\n"
#: fe-auth.c:514
#, c-format
msgid "authentication method %u not supported\n"
msgstr "Authentifizierungsmethode %u nicht untersttzt\n"
#: fe-auth.c:551
#, c-format
msgid "invalid authentication service name \"%s\", ignored"
msgstr "ungltiger Authentifizierungsdienstname %s, ignoriert"
#: fe-auth.c:608
#, c-format
msgid "fe_getauthname: invalid authentication system: %d\n"
msgstr "fe_getauthname: ungltiges Authentifizierungssystem: %d\n"
#: fe-connect.c:491
msgid "could not determine the PostgreSQL user name to use\n"
msgstr "konnte den zu verwendenden PostgreSQL-Benutzernamen nicht bestimmen\n"
#: fe-connect.c:713
#, c-format
msgid "could not socket to non-blocking mode: %s\n"
msgstr "konnte Socket nicht auf nicht-blockierenden Modus umstellen: %s\n"
#: fe-connect.c:737
#, c-format
msgid "could not set socket to TCP no delay mode: %s\n"
msgstr "konnte Socket nicht auf TCP No Delay-Modus umstellen: %s\n"
#: fe-connect.c:760
#, c-format
msgid ""
"could not connect to server: %s\n"
"\tIs the server running locally and accepting\n"
"\tconnections on Unix domain socket \"%s\"?\n"
msgstr ""
"konnte nicht mit dem Server verbinden: %s\n"
"\tLuft der Server lokal und akzeptiert er Verbindungen\n"
"\tauf dem Unix-Domain-Socket %s?\n"
#: fe-connect.c:769
#, c-format
msgid ""
"could not connect to server: %s\n"
"\tIs the server running on host %s and accepting\n"
"\tTCP/IP connections on port %s?\n"
msgstr ""
"konnte nicht mit dem Server verbinden: %s\n"
"\tLuft der Server auf dem Host %s und akzeptiert er\n"
"\tTCP/IP-Verbindungen auf Port %s?\n"
#: fe-connect.c:834
#, c-format
msgid "invalid host address: %s\n"
msgstr "ungltige Hostadresse: %s\n"
#: fe-connect.c:853
#, c-format
msgid "unknown host name: %s\n"
msgstr "unbekannter Hostname: %s\n"
#: fe-connect.c:895
#, c-format
msgid "could not create socket: %s\n"
msgstr "konnte Socket nicht erzeugen: %s\n"
#: fe-connect.c:975
#, c-format
msgid "could not send SSL negotiation packet: %s\n"
msgstr "konnte Paket zur SSL-Verhandlung nicht senden: %s\n"
#: fe-connect.c:983
#, c-format
msgid "could not receive server response to SSL negotiation packet: %s\n"
msgstr "konnte Serverantwort auf SSL-Verhandlungspaket nicht empfangen: %s\n"
#: fe-connect.c:997
#, c-format
msgid "could not create SSL context: %s\n"
msgstr "konnte SSL-Kontext nicht erzeugen: %s\n"
#: fe-connect.c:1007
#, c-format
msgid "could not establish SSL connection: %s\n"
msgstr "konnte SSL-Verbindung nicht aufbauen: %s\n"
#: fe-connect.c:1025
#, c-format
msgid "received invalid response to SSL negotiation: %c\n"
msgstr "ungltige Antwort auf SSL-Verhandlungspaket empfangen: %c\n"
#: fe-connect.c:1034
msgid "server does not support SSL, but SSL was required\n"
msgstr "Server untersttzt kein SSL, aber SSL wurde verlangt\n"
#: fe-connect.c:1203
msgid "invalid connection state, probably indicative of memory corruption\n"
msgstr "ungltiger Verbindungszustand, mglicherweise ein Speicherproblem\n"
#: fe-connect.c:1241
#, c-format
msgid "could not get socket error status: %s\n"
msgstr "konnte Socket-Fehlerstatus nicht ermitteln: %s\n"
#: fe-connect.c:1262
#, c-format
msgid "could not get client address from socket: %s\n"
msgstr "konnte Client-Adresse vom Socket nicht ermitteln: %s\n"
#: fe-connect.c:1301
#, c-format
msgid "could not send startup packet: %s\n"
msgstr "konnte Startpaket nicht senden: %s\n"
#: fe-connect.c:1357
#, c-format
msgid "expected authentication request from server, but received %c\n"
msgstr ""
"Authentifizierungsanfrage wurde vom Server erwartet, aber %c wurde "
"empfangen\n"
#: fe-connect.c:1460
msgid "unexpected message from server during startup\n"
msgstr "unerwartete Nachricht vom Server beim Start\n"
#: fe-connect.c:1519
#, c-format
msgid "invalid connection state %c, probably indicative of memory corruption\n"
msgstr "ungltiger Verbindungszustand %c, mglicherweise ein Speicherproblem\n"
#: fe-connect.c:1623
#, c-format
msgid "invalid setenv state %c, probably indicative of memory corruption\n"
msgstr "ungltiger setenv-Zustand %c, mglicherweise ein Speicherproblem\n"
#: fe-connect.c:1664
#, c-format
msgid "invalid encoding name in PGCLIENTENCODING: %s\n"
msgstr "ungltiger Kodierungsname in PGCLIENTENCODING: %s\n"
#: fe-connect.c:1789
#, c-format
msgid "invalid state %c, probably indicative of memory corruption\n"
msgstr "ungltiger Zustand %c, mglicherweise ein Speicherproblem\n"
#: fe-connect.c:2402 fe-connect.c:2411 fe-exec.c:1070 fe-lobj.c:529
msgid "out of memory\n"
msgstr "Speicher aufgebraucht\n"
#: fe-connect.c:2450
#, c-format
msgid "missing \"=\" after \"%s\" in connection info string\n"
msgstr "fehlendes = nach %s in der Zeichenkette der Verbindungsdaten\n"
#: fe-connect.c:2499
msgid "unterminated quoted string in connection info string\n"
msgstr ""
"fehlendes schlieendes Anfhrungszeichen (\") in der Zeichenkette der "
"Verbindugsdaten\n"
#: fe-connect.c:2533
#, c-format
msgid "invalid connection option \"%s\"\n"
msgstr "ungltige Verbindungsoption %s\n"
#: fe-connect.c:2718
msgid "connection pointer is NULL\n"
msgstr "Verbindung ist ein NULL-Zeiger\n"
#: fe-exec.c:512
msgid "command string is a null pointer\n"
msgstr "Kommandozeichenkette ist ein NULL-Zeiger\n"
#: fe-exec.c:520
msgid "no connection to the server\n"
msgstr "keine Verbindung mit dem Server\n"
#: fe-exec.c:527
msgid "another command is already in progress\n"
msgstr "ein anderes Kommando ist bereits in Ausfhrung\n"
#: fe-exec.c:730
#, c-format
msgid "message type 0x%02x arrived from server while idle\n"
msgstr "Nachricht vom Typ 0x%02x kam im Leerlaufzustand vom Server\n"
#: fe-exec.c:773
#, c-format
msgid ""
"unexpected character %c following empty query response (\"I\" message)\n"
msgstr ""
"unerwartetes Zeichen %c nach Antwort auf leere Anweisung (I-Nachricht)\n"
#: fe-exec.c:831
msgid ""
"server sent data (\"D\" message) without prior row description (\"T\" "
"message)\n"
msgstr ""
"Server sendete Daten (D-Nachricht) ohne vorherige Zeilenbeschreibung (T-"
"Nachricht)\n"
#: fe-exec.c:848
msgid ""
"server sent binary data (\"B\" message) without prior row description (\"T\" "
"message)\n"
msgstr ""
"Server sendete binre Daten (B-Nachricht) ohne vorherige "
"Zeilenbeschreibung (T-Nachricht)\n"
#: fe-exec.c:864
#, c-format
msgid "unexpected response from server; first received character was \"%c\"\n"
msgstr "unerwartete Antwort vom Server; erstes empfangenes Zeichen war %c\n"
#: fe-exec.c:1158
#, c-format
msgid "unexpected asyncStatus: %d\n"
msgstr "unerwarteter asyncStatus: %d\n"
#: fe-exec.c:1208
msgid "COPY state must be terminated first\n"
msgstr "COPY-Zustand mu erst beendet werden\n"
#: fe-exec.c:1546
msgid "no COPY in progress\n"
msgstr "keine COPY in Ausfhrung\n"
#: fe-exec.c:1585
msgid "lost synchronization with server, resetting connection\n"
msgstr ""
"Synchronisation mit dem Server verloren, Verbindung wird zurckgesetzt\n"
#: fe-exec.c:1650
msgid "connection in wrong state\n"
msgstr "Verbindung im falschen Zustand\n"
#: fe-exec.c:1752 fe-exec.c:1786
#, c-format
msgid "protocol error: id=0x%x\n"
msgstr "Protokollfehler: id=0x%x\n"
#: fe-exec.c:1821
msgid "invalid ExecStatusType code"
msgstr "ungltiger ExecStatusType-Kode"
#: fe-exec.c:1874 fe-exec.c:1907
#, c-format
msgid "column number %d is out of range 0..%d\n"
msgstr "Spaltennummer %d auerhalb des zulssigem Bereichs 0..%d\n"
#: fe-exec.c:1896
#, c-format
msgid "row number %d is out of range 0..%d\n"
msgstr "Zeilennummer %d auerhalb des zulssigem Bereichs 0..%d\n"
#: fe-exec.c:2087
#, c-format
msgid "could not interpret result from server: %s\n"
msgstr "konnte Ergebnis vom Server nicht interpretieren: %s\n"
#: fe-exec.c:2103
msgid "no row count available\n"
msgstr "keine Zeilenzahl verfgbar\n"
#: fe-lobj.c:399 fe-lobj.c:478
#, c-format
msgid "could not open file \"%s\": %s\n"
msgstr "konnte Datei %s nicht ffnen: %s\n"
#: fe-lobj.c:411
#, c-format
msgid "could not create large object for file \"%s\"\n"
msgstr "konnte Large Object fr Datei %s nicht erzeugen\n"
#: fe-lobj.c:420 fe-lobj.c:467
#, c-format
msgid "could not open large object %u\n"
msgstr "konnte Large Object %u nicht ffnen\n"
#: fe-lobj.c:434
#, c-format
msgid "error while reading file \"%s\"\n"
msgstr "Fehler beim Lesen der Datei %s\n"
#: fe-lobj.c:492
#, c-format
msgid "error while writing to file \"%s\"\n"
msgstr "Fehler beim Schreiben der Datei %s\n"
#: fe-lobj.c:557
msgid "query to initialize large object functions did not return data\n"
msgstr ""
"Abfrage zur Initialisierung der Large-Object-Funktionen ergab keine Daten\n"
#: fe-lobj.c:595
msgid "cannot determine OID of function lo_open\n"
msgstr "kann OID der Funktion lo_open nicht ermitteln\n"
#: fe-lobj.c:602
msgid "cannot determine OID of function lo_close\n"
msgstr "kann OID der Funktion lo_close nicht ermitteln\n"
#: fe-lobj.c:609
msgid "cannot determine OID of function lo_creat\n"
msgstr "kann OID der Funktion lo_open nicht ermitteln\n"
#: fe-lobj.c:616
msgid "cannot determine OID of function lo_unlink\n"
msgstr "kann OID der Funktion lo_unlink nicht ermitteln\n"
#: fe-lobj.c:623
msgid "cannot determine OID of function lo_lseek\n"
msgstr "kann OID der Funktion lo_lseek nicht ermitteln\n"
#: fe-lobj.c:630
msgid "cannot determine OID of function lo_tell\n"
msgstr "kann OID der Funktion lo_tell nicht ermitteln\n"
#: fe-lobj.c:637
msgid "cannot determine OID of function loread\n"
msgstr "kann OID der Funktion loread nicht ermitteln\n"
#: fe-lobj.c:644
msgid "cannot determine OID of function lowrite\n"
msgstr "kann OID der Funktion lowrite nicht ermitteln\n"
#: fe-misc.c:131
#, c-format
msgid "could not flush enough data (space available: %d, space needed %d)\n"
msgstr ""
"konnte nicht genug Daten flushen (verfgbarer Platz: %d, bentigter Platz: %"
"d)\n"
#: fe-misc.c:279
#, c-format
msgid "integer of size %lu not supported by pqGetInt\n"
msgstr "Integer der Gre %lu wird nicht von pqGetInt untersttzt\n"
#: fe-misc.c:317
#, c-format
msgid "integer of size %lu not supported by pqPutInt\n"
msgstr "Integer der Gre %lu wird nicht von pqPutInt untersttzt\n"
#: fe-misc.c:355 fe-misc.c:389 fe-misc.c:777
#, c-format
msgid "select() failed: %s\n"
msgstr "select() fehlgeschlagen: %s\n"
#: fe-misc.c:415 fe-misc.c:615 fe-misc.c:756
msgid "connection not open\n"
msgstr "Verbindung nicht offen\n"
#: fe-misc.c:486 fe-misc.c:572
#, c-format
msgid "could not receive data from server: %s\n"
msgstr "konnte keine Daten vom Server empfangen: %s\n"
#: fe-misc.c:589 fe-misc.c:674
msgid ""
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n"
msgstr ""
"Server beendete die Verbindung unerwartet\n"
"\tDas heit wahrscheinlich, da der Server abnormal beendete\n"
"\tbevor oder whrend die Anweisung bearbeitet wurde.\n"
#: fe-misc.c:690
#, c-format
msgid "could not send data to server: %s\n"
msgstr "konnte keine Daten an den Server senden: %s\n"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.47 2001/03/22 04:01:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.48 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -160,7 +160,7 @@ pg_krb4_authname(char *PQerrormsg) ...@@ -160,7 +160,7 @@ pg_krb4_authname(char *PQerrormsg)
status = krb_get_tf_fullname(tkt_string(), name, instance, realm); status = krb_get_tf_fullname(tkt_string(), name, instance, realm);
if (status != KSUCCESS) if (status != KSUCCESS)
{ {
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb4_authname: krb_get_tf_fullname: %s\n", "pg_krb4_authname: krb_get_tf_fullname: %s\n",
krb_err_txt[status]); krb_err_txt[status]);
return (char *) NULL; return (char *) NULL;
...@@ -218,8 +218,8 @@ pg_krb4_sendauth(char *PQerrormsg, int sock, ...@@ -218,8 +218,8 @@ pg_krb4_sendauth(char *PQerrormsg, int sock,
PG_KRB4_VERSION); PG_KRB4_VERSION);
if (status != KSUCCESS) if (status != KSUCCESS)
{ {
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb4_sendauth: kerberos error: %s\n", libpq_gettext("Kerberos 4 error: %s\n"),
krb_err_txt[status]); krb_err_txt[status]);
return STATUS_ERROR; return STATUS_ERROR;
} }
...@@ -384,7 +384,7 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, ...@@ -384,7 +384,7 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
if (flags < 0 || fcntl(sock, F_SETFL, (long) (flags & ~O_NONBLOCK))) if (flags < 0 || fcntl(sock, F_SETFL, (long) (flags & ~O_NONBLOCK)))
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb5_sendauth: fcntl: %s", strerror(errno)); libpq_gettext("could not set socket to blocking mode: %s"), strerror(errno));
krb5_free_principal(pg_krb5_context, server); krb5_free_principal(pg_krb5_context, server);
return STATUS_ERROR; return STATUS_ERROR;
} }
...@@ -400,13 +400,13 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, ...@@ -400,13 +400,13 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
if (retval == KRB5_SENDAUTH_REJECTED && err_ret) if (retval == KRB5_SENDAUTH_REJECTED && err_ret)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb5_sendauth: authentication rejected: \"%*s\"", libpq_gettext("Kerberos 5 authentication rejected: %*s"),
err_ret->text.length, err_ret->text.data); err_ret->text.length, err_ret->text.data);
} }
else else
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb5_sendauth: krb5_sendauth: %s", "krb5_sendauth: %s",
error_message(retval)); error_message(retval));
} }
...@@ -421,7 +421,8 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, ...@@ -421,7 +421,8 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
if (fcntl(sock, F_SETFL, (long) flags)) if (fcntl(sock, F_SETFL, (long) flags))
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"pg_krb5_sendauth: fcntl: %s", strerror(errno)); libpq_gettext("could not restore non-blocking mode on socket: %s"),
strerror(errno));
ret = STATUS_ERROR; ret = STATUS_ERROR;
} }
...@@ -463,14 +464,14 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, ...@@ -463,14 +464,14 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
&conn->raddr.in, &conn->raddr.in,
hostname) != STATUS_OK) hostname) != STATUS_OK)
{ {
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_sendauth: krb4 authentication failed\n"); libpq_gettext("Kerberos 4 authentication failed\n"));
return STATUS_ERROR; return STATUS_ERROR;
} }
break; break;
#else #else
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_sendauth: krb4 authentication not supported\n"); libpq_gettext("Kerberos 4 authentication not supported\n"));
return STATUS_ERROR; return STATUS_ERROR;
#endif #endif
...@@ -480,14 +481,14 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, ...@@ -480,14 +481,14 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
&conn->raddr.in, &conn->raddr.in,
hostname) != STATUS_OK) hostname) != STATUS_OK)
{ {
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_sendauth: krb5 authentication failed\n"); libpq_gettext("Kerberos 5 authentication failed\n"));
return STATUS_ERROR; return STATUS_ERROR;
} }
break; break;
#else #else
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_sendauth: krb5 authentication not supported\n"); libpq_gettext("Kerberos 5 authentication not supported\n"));
return STATUS_ERROR; return STATUS_ERROR;
#endif #endif
...@@ -509,8 +510,8 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, ...@@ -509,8 +510,8 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
break; break;
default: default:
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_sendauth: authentication type %u not supported\n", areq); libpq_gettext("authentication method %u not supported\n"), areq);
return STATUS_ERROR; return STATUS_ERROR;
} }
...@@ -546,8 +547,8 @@ fe_setauthsvc(const char *name, char *PQerrormsg) ...@@ -546,8 +547,8 @@ fe_setauthsvc(const char *name, char *PQerrormsg)
} }
if (i == n_authsvcs) if (i == n_authsvcs)
{ {
(void) sprintf(PQerrormsg, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"fe_setauthsvc: invalid name: %s, ignoring...\n", libpq_gettext("invalid authentication service name \"%s\", ignored"),
name); name);
} }
return; return;
...@@ -603,7 +604,9 @@ fe_getauthname(char *PQerrormsg) ...@@ -603,7 +604,9 @@ fe_getauthname(char *PQerrormsg)
} }
if (authsvc != STARTUP_MSG && authsvc != STARTUP_KRB4_MSG && authsvc != STARTUP_KRB5_MSG) if (authsvc != STARTUP_MSG && authsvc != STARTUP_KRB4_MSG && authsvc != STARTUP_KRB5_MSG)
sprintf(PQerrormsg, "fe_getauthname: invalid authentication system: %d\n", authsvc); snprintf(PQerrormsg, PQERRORMSG_LENGTH,
libpq_gettext("fe_getauthname: invalid authentication system: %d\n"),
authsvc);
if (name && (authn = (char *) malloc(strlen(name) + 1))) if (name && (authn = (char *) malloc(strlen(name) + 1)))
strcpy(authn, name); strcpy(authn, name);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.166 2001/07/06 19:04:23 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.167 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -488,7 +488,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, ...@@ -488,7 +488,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
{ {
error = TRUE; error = TRUE;
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"FATAL: PQsetdbLogin(): Unable to determine a Postgres username!\n"); libpq_gettext("could not determine the PostgreSQL user name to use\n"));
} }
if (pwd) if (pwd)
...@@ -710,8 +710,8 @@ connectMakeNonblocking(PGconn *conn) ...@@ -710,8 +710,8 @@ connectMakeNonblocking(PGconn *conn)
#endif #endif
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectMakeNonblocking -- fcntl() failed: errno=%d\n%s\n", libpq_gettext("could not socket to non-blocking mode: %s\n"),
errno, strerror(errno)); strerror(errno));
return 0; return 0;
} }
...@@ -734,8 +734,8 @@ connectNoDelay(PGconn *conn) ...@@ -734,8 +734,8 @@ connectNoDelay(PGconn *conn)
sizeof(on)) < 0) sizeof(on)) < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectNoDelay() -- setsockopt failed: errno=%d\n%s\n", libpq_gettext("could not set socket to TCP no delay mode: %s\n"),
errno, strerror(errno)); strerror(errno));
#ifdef WIN32 #ifdef WIN32
printf("Winsock error: %i\n", WSAGetLastError()); printf("Winsock error: %i\n", WSAGetLastError());
#endif #endif
...@@ -752,26 +752,30 @@ connectNoDelay(PGconn *conn) ...@@ -752,26 +752,30 @@ connectNoDelay(PGconn *conn)
* ---------- * ----------
*/ */
static void static void
connectFailureMessage(PGconn *conn, const char *caller, int errorno) connectFailureMessage(PGconn *conn, int errorno)
{ {
#ifdef HAVE_UNIX_SOCKETS
if (conn->raddr.sa.sa_family == AF_UNIX) if (conn->raddr.sa.sa_family == AF_UNIX)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"%s -- connect() failed: %s\n" libpq_gettext(
"\tIs the postmaster running locally\n" "could not connect to server: %s\n"
"\tand accepting connections on Unix socket '%s'?\n", "\tIs the server running locally and accepting\n"
caller, "\tconnections on Unix domain socket \"%s\"?\n"
),
strerror(errorno), strerror(errorno),
conn->raddr.un.sun_path); conn->raddr.un.sun_path);
else else
#endif
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"%s -- connect() failed: %s\n" libpq_gettext(
"\tIs the postmaster running (with -i) at '%s'\n" "could not connect to server: %s\n"
"\tand accepting connections on TCP/IP port %s?\n", "\tIs the server running on host %s and accepting\n"
caller, "\tTCP/IP connections on port %s?\n"
),
strerror(errorno), strerror(errorno),
conn->pghost ? conn->pghost : "localhost", conn->pghost
? conn->pghost
: (conn->pghostaddr
? conn->pghostaddr
: "???"),
conn->pgport); conn->pgport);
} }
...@@ -827,8 +831,8 @@ connectDBStart(PGconn *conn) ...@@ -827,8 +831,8 @@ connectDBStart(PGconn *conn)
if (!inet_aton(conn->pghostaddr, &addr)) if (!inet_aton(conn->pghostaddr, &addr))
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDBStart() -- " libpq_gettext("invalid host address: %s\n"),
"invalid host address: %s\n", conn->pghostaddr); conn->pghostaddr);
goto connect_errReturn; goto connect_errReturn;
} }
...@@ -846,7 +850,7 @@ connectDBStart(PGconn *conn) ...@@ -846,7 +850,7 @@ connectDBStart(PGconn *conn)
if ((hp == NULL) || (hp->h_addrtype != AF_INET)) if ((hp == NULL) || (hp->h_addrtype != AF_INET))
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDBStart() -- unknown hostname: %s\n", libpq_gettext("unknown host name: %s\n"),
conn->pghost); conn->pghost);
goto connect_errReturn; goto connect_errReturn;
} }
...@@ -858,7 +862,7 @@ connectDBStart(PGconn *conn) ...@@ -858,7 +862,7 @@ connectDBStart(PGconn *conn)
} }
else else
{ {
/* pghostaddr and pghost are NULL, so use UDP */ /* pghostaddr and pghost are NULL, so use Unix domain socket */
family = AF_UNIX; family = AF_UNIX;
} }
...@@ -888,9 +892,8 @@ connectDBStart(PGconn *conn) ...@@ -888,9 +892,8 @@ connectDBStart(PGconn *conn)
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0) if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDBStart() -- " libpq_gettext("could not create socket: %s\n"),
"socket() failed: errno=%d\n%s\n", strerror(errno));
errno, strerror(errno));
goto connect_errReturn; goto connect_errReturn;
} }
...@@ -950,7 +953,7 @@ connectDBStart(PGconn *conn) ...@@ -950,7 +953,7 @@ connectDBStart(PGconn *conn)
else else
{ {
/* Something's gone wrong */ /* Something's gone wrong */
connectFailureMessage(conn, "connectDBStart()", errno); connectFailureMessage(conn, errno);
goto connect_errReturn; goto connect_errReturn;
} }
} }
...@@ -969,15 +972,16 @@ connectDBStart(PGconn *conn) ...@@ -969,15 +972,16 @@ connectDBStart(PGconn *conn)
if (pqPacketSend(conn, (char *) &np, sizeof(StartupPacket)) != STATUS_OK) if (pqPacketSend(conn, (char *) &np, sizeof(StartupPacket)) != STATUS_OK)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDB() -- couldn't send SSL negotiation packet: errno=%d\n%s\n", libpq_gettext("could not send SSL negotiation packet: %s\n"),
errno, strerror(errno)); strerror(errno));
goto connect_errReturn; goto connect_errReturn;
} }
/* Now receive the postmasters response */ /* Now receive the postmasters response */
if (recv(conn->sock, &SSLok, 1, 0) != 1) if (recv(conn->sock, &SSLok, 1, 0) != 1)
{ {
printfPQExpBuffer(&conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n", printfPQExpBuffer(&conn->errorMessage,
errno, strerror(errno)); libpq_gettext("could not receive server response to SSL negotiation packet: %s\n"),
strerror(errno));
goto connect_errReturn; goto connect_errReturn;
} }
if (SSLok == 'S') if (SSLok == 'S')
...@@ -990,7 +994,7 @@ connectDBStart(PGconn *conn) ...@@ -990,7 +994,7 @@ connectDBStart(PGconn *conn)
if (!SSL_context) if (!SSL_context)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDB() -- couldn't create SSL context: %s\n", libpq_gettext("could not create SSL context: %s\n"),
ERR_reason_error_string(ERR_get_error())); ERR_reason_error_string(ERR_get_error()));
goto connect_errReturn; goto connect_errReturn;
} }
...@@ -1000,7 +1004,7 @@ connectDBStart(PGconn *conn) ...@@ -1000,7 +1004,7 @@ connectDBStart(PGconn *conn)
SSL_connect(conn->ssl) <= 0) SSL_connect(conn->ssl) <= 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"connectDB() -- couldn't establish SSL connection: %s\n", libpq_gettext("could not establish SSL connection: %s\n"),
ERR_reason_error_string(ERR_get_error())); ERR_reason_error_string(ERR_get_error()));
goto connect_errReturn; goto connect_errReturn;
} }
...@@ -1018,7 +1022,8 @@ connectDBStart(PGconn *conn) ...@@ -1018,7 +1022,8 @@ connectDBStart(PGconn *conn)
else if (SSLok != 'N') else if (SSLok != 'N')
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"Received invalid negotiation response.\n"); libpq_gettext("received invalid response to SSL negotiation: %c\n"),
SSLok);
goto connect_errReturn; goto connect_errReturn;
} }
} }
...@@ -1026,7 +1031,7 @@ connectDBStart(PGconn *conn) ...@@ -1026,7 +1031,7 @@ connectDBStart(PGconn *conn)
{ {
/* Require SSL, but server does not support/want it */ /* Require SSL, but server does not support/want it */
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"Server does not support SSL when SSL was required.\n"); libpq_gettext("server does not support SSL, but SSL was required\n"));
goto connect_errReturn; goto connect_errReturn;
} }
#endif #endif
...@@ -1194,8 +1199,10 @@ PQconnectPoll(PGconn *conn) ...@@ -1194,8 +1199,10 @@ PQconnectPoll(PGconn *conn)
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- unknown connection state - " libpq_gettext(
"probably indicative of memory corruption!\n"); "invalid connection state, "
"probably indicative of memory corruption\n"
));
goto error_return; goto error_return;
} }
...@@ -1231,9 +1238,8 @@ keep_going: /* We will come back to here until there ...@@ -1231,9 +1238,8 @@ keep_going: /* We will come back to here until there
(char *) &optval, &optlen) == -1) (char *) &optval, &optlen) == -1)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- getsockopt() failed: " libpq_gettext("could not get socket error status: %s\n"),
"errno=%d\n%s\n", strerror(errno));
errno, strerror(errno));
goto error_return; goto error_return;
} }
else if (optval != 0) else if (optval != 0)
...@@ -1244,7 +1250,7 @@ keep_going: /* We will come back to here until there ...@@ -1244,7 +1250,7 @@ keep_going: /* We will come back to here until there
* see connect failures at this point, so provide a * see connect failures at this point, so provide a
* friendly error message. * friendly error message.
*/ */
connectFailureMessage(conn, "PQconnectPoll()", optval); connectFailureMessage(conn, optval);
goto error_return; goto error_return;
} }
...@@ -1253,9 +1259,8 @@ keep_going: /* We will come back to here until there ...@@ -1253,9 +1259,8 @@ keep_going: /* We will come back to here until there
if (getsockname(conn->sock, &conn->laddr.sa, &laddrlen) < 0) if (getsockname(conn->sock, &conn->laddr.sa, &laddrlen) < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- getsockname() failed: " libpq_gettext("could not get client address from socket: %s\n"),
"errno=%d\n%s\n", strerror(errno));
errno, strerror(errno));
goto error_return; goto error_return;
} }
...@@ -1293,10 +1298,8 @@ keep_going: /* We will come back to here until there ...@@ -1293,10 +1298,8 @@ keep_going: /* We will come back to here until there
sizeof(StartupPacket)) != STATUS_OK) sizeof(StartupPacket)) != STATUS_OK)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- " libpq_gettext("could not send startup packet: %s\n"),
"couldn't send startup packet: " strerror(errno));
"errno=%d\n%s\n",
errno, strerror(errno));
goto error_return; goto error_return;
} }
...@@ -1350,8 +1353,11 @@ keep_going: /* We will come back to here until there ...@@ -1350,8 +1353,11 @@ keep_going: /* We will come back to here until there
if (beresp != 'R') if (beresp != 'R')
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- expected " libpq_gettext(
"authentication request\n"); "expected authentication request from "
"server, but received %c\n"
),
beresp);
goto error_return; goto error_return;
} }
...@@ -1451,8 +1457,7 @@ keep_going: /* We will come back to here until there ...@@ -1451,8 +1457,7 @@ keep_going: /* We will come back to here until there
{ {
if (res->resultStatus != PGRES_FATAL_ERROR) if (res->resultStatus != PGRES_FATAL_ERROR)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- unexpected message " libpq_gettext("unexpected message from server during startup\n"));
"during startup\n");
/* /*
* if the resultStatus is FATAL, then * if the resultStatus is FATAL, then
...@@ -1510,8 +1515,11 @@ keep_going: /* We will come back to here until there ...@@ -1510,8 +1515,11 @@ keep_going: /* We will come back to here until there
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- unknown connection state - " libpq_gettext(
"probably indicative of memory corruption!\n"); "invalid connection state %c, "
"probably indicative of memory corruption\n"
),
conn->status);
goto error_return; goto error_return;
} }
...@@ -1611,8 +1619,11 @@ PQsetenvPoll(PGconn *conn) ...@@ -1611,8 +1619,11 @@ PQsetenvPoll(PGconn *conn)
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQsetenvPoll() -- unknown state - " libpq_gettext(
"probably indicative of memory corruption!\n"); "invalid setenv state %c, "
"probably indicative of memory corruption\n"
),
conn->setenv_state);
goto error_return; goto error_return;
} }
...@@ -1649,8 +1660,9 @@ keep_going: /* We will come back to here until there ...@@ -1649,8 +1660,9 @@ keep_going: /* We will come back to here until there
if (encoding < 0) if (encoding < 0)
{ {
strcpy(conn->errorMessage.data, printfPQExpBuffer(&conn->errorMessage,
"PGCLIENTENCODING has no valid encoding name.\n"); libpq_gettext("invalid encoding name in PGCLIENTENCODING: %s\n"),
env);
goto error_return; goto error_return;
} }
conn->client_encoding = encoding; conn->client_encoding = encoding;
...@@ -1774,8 +1786,9 @@ keep_going: /* We will come back to here until there ...@@ -1774,8 +1786,9 @@ keep_going: /* We will come back to here until there
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQsetenvPoll() -- unknown state - " libpq_gettext("invalid state %c, "
"probably indicative of memory corruption!\n"); "probably indicative of memory corruption\n"),
conn->setenv_state);
goto error_return; goto error_return;
} }
...@@ -2386,7 +2399,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2386,7 +2399,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
if (options == NULL) if (options == NULL)
{ {
printfPQExpBuffer(errorMessage, printfPQExpBuffer(errorMessage,
"FATAL: cannot allocate memory for copy of PQconninfoOptions\n"); libpq_gettext("out of memory\n"));
return NULL; return NULL;
} }
memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions)); memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions));
...@@ -2395,7 +2408,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2395,7 +2408,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
if ((buf = strdup(conninfo)) == NULL) if ((buf = strdup(conninfo)) == NULL)
{ {
printfPQExpBuffer(errorMessage, printfPQExpBuffer(errorMessage,
"FATAL: cannot allocate memory for copy of conninfo string\n"); libpq_gettext("out of memory\n"));
PQconninfoFree(options); PQconninfoFree(options);
return NULL; return NULL;
} }
...@@ -2434,7 +2447,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2434,7 +2447,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
if (*cp != '=') if (*cp != '=')
{ {
printfPQExpBuffer(errorMessage, printfPQExpBuffer(errorMessage,
"ERROR: Missing '=' after '%s' in conninfo\n", libpq_gettext("missing \"=\" after \"%s\" in connection info string\n"),
pname); pname);
PQconninfoFree(options); PQconninfoFree(options);
free(buf); free(buf);
...@@ -2483,7 +2496,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2483,7 +2496,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
if (*cp == '\0') if (*cp == '\0')
{ {
printfPQExpBuffer(errorMessage, printfPQExpBuffer(errorMessage,
"ERROR: PQconnectdb() - unterminated quoted string in conninfo\n"); libpq_gettext("unterminated quoted string in connection info string\n"));
PQconninfoFree(options); PQconninfoFree(options);
free(buf); free(buf);
return NULL; return NULL;
...@@ -2517,7 +2530,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2517,7 +2530,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
if (option->keyword == NULL) if (option->keyword == NULL)
{ {
printfPQExpBuffer(errorMessage, printfPQExpBuffer(errorMessage,
"ERROR: Unknown conninfo option '%s'\n", libpq_gettext("invalid connection option \"%s\"\n"),
pname); pname);
PQconninfoFree(options); PQconninfoFree(options);
free(buf); free(buf);
...@@ -2702,7 +2715,7 @@ char * ...@@ -2702,7 +2715,7 @@ char *
PQerrorMessage(const PGconn *conn) PQerrorMessage(const PGconn *conn)
{ {
if (!conn) if (!conn)
return "PQerrorMessage: conn pointer is NULL\n"; return libpq_gettext("connection pointer is NULL\n");
return conn->errorMessage.data; return conn->errorMessage.data;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.102 2001/07/06 17:58:53 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.103 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -509,7 +509,7 @@ PQsendQuery(PGconn *conn, const char *query) ...@@ -509,7 +509,7 @@ PQsendQuery(PGconn *conn, const char *query)
if (!query) if (!query)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQsendQuery() -- query pointer is null.\n"); libpq_gettext("command string is a null pointer\n"));
return 0; return 0;
} }
...@@ -517,15 +517,14 @@ PQsendQuery(PGconn *conn, const char *query) ...@@ -517,15 +517,14 @@ PQsendQuery(PGconn *conn, const char *query)
if (conn->status != CONNECTION_OK) if (conn->status != CONNECTION_OK)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQsendQuery() -- There is no connection " libpq_gettext("no connection to the server\n"));
"to the backend.\n");
return 0; return 0;
} }
/* Can't send while already busy, either. */ /* Can't send while already busy, either. */
if (conn->asyncStatus != PGASYNC_IDLE) if (conn->asyncStatus != PGASYNC_IDLE)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQsendQuery() -- another query already in progress.\n"); libpq_gettext("another command is already in progress\n"));
return 0; return 0;
} }
...@@ -727,8 +726,8 @@ parseInput(PGconn *conn) ...@@ -727,8 +726,8 @@ parseInput(PGconn *conn)
} }
else else
{ {
sprintf(noticeWorkspace, snprintf(noticeWorkspace, sizeof(noticeWorkspace),
"Backend message type 0x%02x arrived while idle\n", libpq_gettext("message type 0x%02x arrived from server while idle\n"),
id); id);
DONOTICE(conn, noticeWorkspace); DONOTICE(conn, noticeWorkspace);
/* Discard the unexpected message; good idea?? */ /* Discard the unexpected message; good idea?? */
...@@ -770,8 +769,8 @@ parseInput(PGconn *conn) ...@@ -770,8 +769,8 @@ parseInput(PGconn *conn)
return; return;
if (id != '\0') if (id != '\0')
{ {
sprintf(noticeWorkspace, snprintf(noticeWorkspace, sizeof(noticeWorkspace),
"unexpected character %c following 'I'\n", libpq_gettext("unexpected character %c following empty query response (\"I\" message)\n"),
id); id);
DONOTICE(conn, noticeWorkspace); DONOTICE(conn, noticeWorkspace);
} }
...@@ -828,8 +827,8 @@ parseInput(PGconn *conn) ...@@ -828,8 +827,8 @@ parseInput(PGconn *conn)
} }
else else
{ {
sprintf(noticeWorkspace, snprintf(noticeWorkspace, sizeof(noticeWorkspace),
"Backend sent D message without prior T\n"); libpq_gettext("server sent data (\"D\" message) without prior row description (\"T\" message)\n"));
DONOTICE(conn, noticeWorkspace); DONOTICE(conn, noticeWorkspace);
/* Discard the unexpected message; good idea?? */ /* Discard the unexpected message; good idea?? */
conn->inStart = conn->inEnd; conn->inStart = conn->inEnd;
...@@ -845,8 +844,8 @@ parseInput(PGconn *conn) ...@@ -845,8 +844,8 @@ parseInput(PGconn *conn)
} }
else else
{ {
sprintf(noticeWorkspace, snprintf(noticeWorkspace, sizeof(noticeWorkspace),
"Backend sent B message without prior T\n"); libpq_gettext("server sent binary data (\"B\" message) without prior row description (\"T\" message)\n"));
DONOTICE(conn, noticeWorkspace); DONOTICE(conn, noticeWorkspace);
/* Discard the unexpected message; good idea?? */ /* Discard the unexpected message; good idea?? */
conn->inStart = conn->inEnd; conn->inStart = conn->inEnd;
...@@ -861,9 +860,8 @@ parseInput(PGconn *conn) ...@@ -861,9 +860,8 @@ parseInput(PGconn *conn)
break; break;
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"Unknown protocol character '%c' read from backend. " libpq_gettext(
"(The protocol character is the first character the " "unexpected response from server; first received character was \"%c\"\n"),
"backend sends in response to a query it receives).\n",
id); id);
/* build an error result holding the error message */ /* build an error result holding the error message */
saveErrorResult(conn); saveErrorResult(conn);
...@@ -1069,7 +1067,7 @@ outOfMemory: ...@@ -1069,7 +1067,7 @@ outOfMemory:
*/ */
pqClearAsyncResult(conn); pqClearAsyncResult(conn);
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"getAnotherTuple() -- out of memory for result\n"); libpq_gettext("out of memory\n"));
conn->result = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR); conn->result = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR);
conn->asyncStatus = PGASYNC_READY; conn->asyncStatus = PGASYNC_READY;
/* Discard the failed message --- good idea? */ /* Discard the failed message --- good idea? */
...@@ -1157,7 +1155,7 @@ PQgetResult(PGconn *conn) ...@@ -1157,7 +1155,7 @@ PQgetResult(PGconn *conn)
break; break;
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQgetResult: Unexpected asyncStatus %d\n", libpq_gettext("unexpected asyncStatus: %d\n"),
(int) conn->asyncStatus); (int) conn->asyncStatus);
res = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR); res = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR);
break; break;
...@@ -1207,7 +1205,7 @@ PQexec(PGconn *conn, const char *query) ...@@ -1207,7 +1205,7 @@ PQexec(PGconn *conn, const char *query)
{ {
PQclear(result); PQclear(result);
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQexec: you gotta get out of a COPY state yourself.\n"); libpq_gettext("COPY state must be terminated first\n"));
/* restore blocking status */ /* restore blocking status */
goto errout; goto errout;
} }
...@@ -1545,7 +1543,7 @@ PQendcopy(PGconn *conn) ...@@ -1545,7 +1543,7 @@ PQendcopy(PGconn *conn)
conn->asyncStatus != PGASYNC_COPY_OUT) conn->asyncStatus != PGASYNC_COPY_OUT)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQendcopy() -- I don't think there's a copy in progress.\n"); libpq_gettext("no COPY in progress\n"));
return 1; return 1;
} }
...@@ -1584,7 +1582,7 @@ PQendcopy(PGconn *conn) ...@@ -1584,7 +1582,7 @@ PQendcopy(PGconn *conn)
if (conn->errorMessage.len > 0) if (conn->errorMessage.len > 0)
DONOTICE(conn, conn->errorMessage.data); DONOTICE(conn, conn->errorMessage.data);
DONOTICE(conn, "PQendcopy: resetting connection\n"); DONOTICE(conn, libpq_gettext("lost synchronization with server, resetting connection\n"));
/* /*
* Users doing non-blocking connections need to handle the reset * Users doing non-blocking connections need to handle the reset
...@@ -1649,7 +1647,7 @@ PQfn(PGconn *conn, ...@@ -1649,7 +1647,7 @@ PQfn(PGconn *conn,
conn->result != NULL) conn->result != NULL)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"PQfn() -- connection in wrong state\n"); libpq_gettext("connection in wrong state\n"));
return NULL; return NULL;
} }
...@@ -1751,7 +1749,7 @@ PQfn(PGconn *conn, ...@@ -1751,7 +1749,7 @@ PQfn(PGconn *conn,
{ {
/* The backend violates the protocol. */ /* The backend violates the protocol. */
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"FATAL: PQfn: protocol error: id=0x%x\n", libpq_gettext("protocol error: id=0x%x\n"),
id); id);
saveErrorResult(conn); saveErrorResult(conn);
conn->inStart = conn->inCursor; conn->inStart = conn->inCursor;
...@@ -1785,7 +1783,7 @@ PQfn(PGconn *conn, ...@@ -1785,7 +1783,7 @@ PQfn(PGconn *conn,
default: default:
/* The backend violates the protocol. */ /* The backend violates the protocol. */
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"FATAL: PQfn: protocol error: id=0x%x\n", libpq_gettext("protocol error: id=0x%x\n"),
id); id);
saveErrorResult(conn); saveErrorResult(conn);
conn->inStart = conn->inCursor; conn->inStart = conn->inCursor;
...@@ -1820,7 +1818,7 @@ char * ...@@ -1820,7 +1818,7 @@ char *
PQresStatus(ExecStatusType status) PQresStatus(ExecStatusType status)
{ {
if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0]) if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
return "Invalid ExecStatusType code"; return libpq_gettext("invalid ExecStatusType code");
return pgresStatus[status]; return pgresStatus[status];
} }
...@@ -1862,7 +1860,7 @@ PQbinaryTuples(const PGresult *res) ...@@ -1862,7 +1860,7 @@ PQbinaryTuples(const PGresult *res)
*/ */
static int static int
check_field_number(const char *routineName, const PGresult *res, int field_num) check_field_number(const PGresult *res, int field_num)
{ {
char noticeBuf[128]; char noticeBuf[128];
...@@ -1872,9 +1870,9 @@ check_field_number(const char *routineName, const PGresult *res, int field_num) ...@@ -1872,9 +1870,9 @@ check_field_number(const char *routineName, const PGresult *res, int field_num)
{ {
if (res->noticeHook) if (res->noticeHook)
{ {
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"%s: ERROR! field number %d is out of range 0..%d\n", libpq_gettext("column number %d is out of range 0..%d\n"),
routineName, field_num, res->numAttributes - 1); field_num, res->numAttributes - 1);
DONOTICE(res, noticeBuf); DONOTICE(res, noticeBuf);
} }
return FALSE; return FALSE;
...@@ -1883,7 +1881,7 @@ check_field_number(const char *routineName, const PGresult *res, int field_num) ...@@ -1883,7 +1881,7 @@ check_field_number(const char *routineName, const PGresult *res, int field_num)
} }
static int static int
check_tuple_field_number(const char *routineName, const PGresult *res, check_tuple_field_number(const PGresult *res,
int tup_num, int field_num) int tup_num, int field_num)
{ {
char noticeBuf[128]; char noticeBuf[128];
...@@ -1894,9 +1892,9 @@ check_tuple_field_number(const char *routineName, const PGresult *res, ...@@ -1894,9 +1892,9 @@ check_tuple_field_number(const char *routineName, const PGresult *res,
{ {
if (res->noticeHook) if (res->noticeHook)
{ {
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"%s: ERROR! tuple number %d is out of range 0..%d\n", libpq_gettext("row number %d is out of range 0..%d\n"),
routineName, tup_num, res->ntups - 1); tup_num, res->ntups - 1);
DONOTICE(res, noticeBuf); DONOTICE(res, noticeBuf);
} }
return FALSE; return FALSE;
...@@ -1905,9 +1903,9 @@ check_tuple_field_number(const char *routineName, const PGresult *res, ...@@ -1905,9 +1903,9 @@ check_tuple_field_number(const char *routineName, const PGresult *res,
{ {
if (res->noticeHook) if (res->noticeHook)
{ {
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"%s: ERROR! field number %d is out of range 0..%d\n", libpq_gettext("column number %d is out of range 0..%d\n"),
routineName, field_num, res->numAttributes - 1); field_num, res->numAttributes - 1);
DONOTICE(res, noticeBuf); DONOTICE(res, noticeBuf);
} }
return FALSE; return FALSE;
...@@ -1921,7 +1919,7 @@ check_tuple_field_number(const char *routineName, const PGresult *res, ...@@ -1921,7 +1919,7 @@ check_tuple_field_number(const char *routineName, const PGresult *res,
char * char *
PQfname(const PGresult *res, int field_num) PQfname(const PGresult *res, int field_num)
{ {
if (!check_field_number("PQfname", res, field_num)) if (!check_field_number(res, field_num))
return NULL; return NULL;
if (res->attDescs) if (res->attDescs)
return res->attDescs[field_num].name; return res->attDescs[field_num].name;
...@@ -1972,7 +1970,7 @@ PQfnumber(const PGresult *res, const char *field_name) ...@@ -1972,7 +1970,7 @@ PQfnumber(const PGresult *res, const char *field_name)
Oid Oid
PQftype(const PGresult *res, int field_num) PQftype(const PGresult *res, int field_num)
{ {
if (!check_field_number("PQftype", res, field_num)) if (!check_field_number(res, field_num))
return InvalidOid; return InvalidOid;
if (res->attDescs) if (res->attDescs)
return res->attDescs[field_num].typid; return res->attDescs[field_num].typid;
...@@ -1983,7 +1981,7 @@ PQftype(const PGresult *res, int field_num) ...@@ -1983,7 +1981,7 @@ PQftype(const PGresult *res, int field_num)
int int
PQfsize(const PGresult *res, int field_num) PQfsize(const PGresult *res, int field_num)
{ {
if (!check_field_number("PQfsize", res, field_num)) if (!check_field_number(res, field_num))
return 0; return 0;
if (res->attDescs) if (res->attDescs)
return res->attDescs[field_num].typlen; return res->attDescs[field_num].typlen;
...@@ -1994,7 +1992,7 @@ PQfsize(const PGresult *res, int field_num) ...@@ -1994,7 +1992,7 @@ PQfsize(const PGresult *res, int field_num)
int int
PQfmod(const PGresult *res, int field_num) PQfmod(const PGresult *res, int field_num)
{ {
if (!check_field_number("PQfmod", res, field_num)) if (!check_field_number(res, field_num))
return 0; return 0;
if (res->attDescs) if (res->attDescs)
return res->attDescs[field_num].atttypmod; return res->attDescs[field_num].atttypmod;
...@@ -2085,8 +2083,8 @@ PQcmdTuples(PGresult *res) ...@@ -2085,8 +2083,8 @@ PQcmdTuples(PGresult *res)
{ {
if (res->noticeHook) if (res->noticeHook)
{ {
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"PQcmdTuples (%s) -- bad input from server\n", libpq_gettext("could not interpret result from server: %s\n"),
res->cmdStatus); res->cmdStatus);
DONOTICE(res, noticeBuf); DONOTICE(res, noticeBuf);
} }
...@@ -2101,8 +2099,8 @@ PQcmdTuples(PGresult *res) ...@@ -2101,8 +2099,8 @@ PQcmdTuples(PGresult *res)
{ {
if (res->noticeHook) if (res->noticeHook)
{ {
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"PQcmdTuples (INSERT) -- there's no # of tuples\n"); libpq_gettext("no row count available\n"));
DONOTICE(res, noticeBuf); DONOTICE(res, noticeBuf);
} }
return ""; return "";
...@@ -2126,7 +2124,7 @@ PQcmdTuples(PGresult *res) ...@@ -2126,7 +2124,7 @@ PQcmdTuples(PGresult *res)
char * char *
PQgetvalue(const PGresult *res, int tup_num, int field_num) PQgetvalue(const PGresult *res, int tup_num, int field_num)
{ {
if (!check_tuple_field_number("PQgetvalue", res, tup_num, field_num)) if (!check_tuple_field_number(res, tup_num, field_num))
return NULL; return NULL;
return res->tuples[tup_num][field_num].value; return res->tuples[tup_num][field_num].value;
} }
...@@ -2140,7 +2138,7 @@ PQgetvalue(const PGresult *res, int tup_num, int field_num) ...@@ -2140,7 +2138,7 @@ PQgetvalue(const PGresult *res, int tup_num, int field_num)
int int
PQgetlength(const PGresult *res, int tup_num, int field_num) PQgetlength(const PGresult *res, int tup_num, int field_num)
{ {
if (!check_tuple_field_number("PQgetlength", res, tup_num, field_num)) if (!check_tuple_field_number(res, tup_num, field_num))
return 0; return 0;
if (res->tuples[tup_num][field_num].len != NULL_LEN) if (res->tuples[tup_num][field_num].len != NULL_LEN)
return res->tuples[tup_num][field_num].len; return res->tuples[tup_num][field_num].len;
...@@ -2154,7 +2152,7 @@ PQgetlength(const PGresult *res, int tup_num, int field_num) ...@@ -2154,7 +2152,7 @@ PQgetlength(const PGresult *res, int tup_num, int field_num)
int int
PQgetisnull(const PGresult *res, int tup_num, int field_num) PQgetisnull(const PGresult *res, int tup_num, int field_num)
{ {
if (!check_tuple_field_number("PQgetisnull", res, tup_num, field_num)) if (!check_tuple_field_number(res, tup_num, field_num))
return 1; /* pretend it is null */ return 1; /* pretend it is null */
if (res->tuples[tup_num][field_num].len == NULL_LEN) if (res->tuples[tup_num][field_num].len == NULL_LEN)
return 1; return 1;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.34 2001/03/22 06:16:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.35 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#include "libpq-fe.h" #include "libpq-fe.h"
#include "libpq-int.h" #include "libpq-int.h"
...@@ -395,8 +396,8 @@ lo_import(PGconn *conn, const char *filename) ...@@ -395,8 +396,8 @@ lo_import(PGconn *conn, const char *filename)
if (fd < 0) if (fd < 0)
{ /* error */ { /* error */
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_import: can't open unix file\"%s\"\n", libpq_gettext("could not open file \"%s\": %s\n"),
filename); filename, strerror(errno));
return InvalidOid; return InvalidOid;
} }
...@@ -407,7 +408,7 @@ lo_import(PGconn *conn, const char *filename) ...@@ -407,7 +408,7 @@ lo_import(PGconn *conn, const char *filename)
if (lobjOid == InvalidOid) if (lobjOid == InvalidOid)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_import: can't create inv object for \"%s\"", libpq_gettext("could not create large object for file \"%s\"\n"),
filename); filename);
return InvalidOid; return InvalidOid;
} }
...@@ -416,7 +417,7 @@ lo_import(PGconn *conn, const char *filename) ...@@ -416,7 +417,7 @@ lo_import(PGconn *conn, const char *filename)
if (lobj == -1) if (lobj == -1)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_import: could not open inv object oid %u", libpq_gettext("could not open large object %u\n"),
lobjOid); lobjOid);
return InvalidOid; return InvalidOid;
} }
...@@ -430,7 +431,7 @@ lo_import(PGconn *conn, const char *filename) ...@@ -430,7 +431,7 @@ lo_import(PGconn *conn, const char *filename)
if (tmp < nbytes) if (tmp < nbytes)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_import: error while reading \"%s\"", libpq_gettext("error while reading file \"%s\"\n"),
filename); filename);
return InvalidOid; return InvalidOid;
} }
...@@ -463,7 +464,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) ...@@ -463,7 +464,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename)
if (lobj == -1) if (lobj == -1)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_export: can't open inv object %u", lobjId); libpq_gettext("could not open large object %u\n"), lobjId);
return -1; return -1;
} }
...@@ -474,8 +475,8 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) ...@@ -474,8 +475,8 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename)
if (fd < 0) if (fd < 0)
{ /* error */ { /* error */
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_export: can't open unix file\"%s\"", libpq_gettext("could not open file \"%s\": %s\n"),
filename); filename, strerror(errno));
return 0; return 0;
} }
...@@ -488,7 +489,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) ...@@ -488,7 +489,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename)
if (tmp < nbytes) if (tmp < nbytes)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"lo_export: error while writing \"%s\"", libpq_gettext("error while writing to file \"%s\"\n"),
filename); filename);
return -1; return -1;
} }
...@@ -525,7 +526,7 @@ lo_initialize(PGconn *conn) ...@@ -525,7 +526,7 @@ lo_initialize(PGconn *conn)
if (lobjfuncs == (PGlobjfuncs *) NULL) if (lobjfuncs == (PGlobjfuncs *) NULL)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"FATAL: malloc() failed in lo_initialize()\n"); libpq_gettext("out of memory\n"));
return -1; return -1;
} }
MemSet((char *) lobjfuncs, 0, sizeof(PGlobjfuncs)); MemSet((char *) lobjfuncs, 0, sizeof(PGlobjfuncs));
...@@ -553,7 +554,7 @@ lo_initialize(PGconn *conn) ...@@ -553,7 +554,7 @@ lo_initialize(PGconn *conn)
free(lobjfuncs); free(lobjfuncs);
PQclear(res); PQclear(res);
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: SELECT didn't return data in lo_initialize()\n"); libpq_gettext("query to initialize large object functions did not return data\n"));
return -1; return -1;
} }
...@@ -591,56 +592,56 @@ lo_initialize(PGconn *conn) ...@@ -591,56 +592,56 @@ lo_initialize(PGconn *conn)
if (lobjfuncs->fn_lo_open == 0) if (lobjfuncs->fn_lo_open == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_open\n"); libpq_gettext("cannot determine OID of function lo_open\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_close == 0) if (lobjfuncs->fn_lo_close == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_close\n"); libpq_gettext("cannot determine OID of function lo_close\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_creat == 0) if (lobjfuncs->fn_lo_creat == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_creat\n"); libpq_gettext("cannot determine OID of function lo_creat\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_unlink == 0) if (lobjfuncs->fn_lo_unlink == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_unlink\n"); libpq_gettext("cannot determine OID of function lo_unlink\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_lseek == 0) if (lobjfuncs->fn_lo_lseek == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_lseek\n"); libpq_gettext("cannot determine OID of function lo_lseek\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_tell == 0) if (lobjfuncs->fn_lo_tell == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lo_tell\n"); libpq_gettext("cannot determine OID of function lo_tell\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_read == 0) if (lobjfuncs->fn_lo_read == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function loread\n"); libpq_gettext("cannot determine OID of function loread\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
if (lobjfuncs->fn_lo_write == 0) if (lobjfuncs->fn_lo_write == 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"ERROR: Cannot determine OID for function lowrite\n"); libpq_gettext("cannot determine OID of function lowrite\n"));
free(lobjfuncs); free(lobjfuncs);
return -1; return -1;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.50 2001/07/06 17:58:53 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.51 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -128,8 +128,7 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn) ...@@ -128,8 +128,7 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
if (nbytes > Max(conn->outBufSize - conn->outCount, 0)) if (nbytes > Max(conn->outBufSize - conn->outCount, 0))
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqPutBytes -- pqFlush couldn't flush enough" libpq_gettext("could not flush enough data (space available: %d, space needed %d)\n"),
" data: space available: %d, space needed %d\n",
Max(conn->outBufSize - conn->outCount, 0), nbytes); Max(conn->outBufSize - conn->outCount, 0), nbytes);
return EOF; return EOF;
} }
...@@ -276,8 +275,9 @@ pqGetInt(int *result, size_t bytes, PGconn *conn) ...@@ -276,8 +275,9 @@ pqGetInt(int *result, size_t bytes, PGconn *conn)
*result = (int) ntohl(tmp4); *result = (int) ntohl(tmp4);
break; break;
default: default:
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"pqGetInt: int size %lu not supported\n", (unsigned long) bytes); libpq_gettext("integer of size %lu not supported by pqGetInt\n"),
(unsigned long) bytes);
DONOTICE(conn, noticeBuf); DONOTICE(conn, noticeBuf);
return EOF; return EOF;
} }
...@@ -313,8 +313,9 @@ pqPutInt(int value, size_t bytes, PGconn *conn) ...@@ -313,8 +313,9 @@ pqPutInt(int value, size_t bytes, PGconn *conn)
return EOF; return EOF;
break; break;
default: default:
sprintf(noticeBuf, snprintf(noticeBuf, sizeof(noticeBuf),
"pqPutInt: int size %lu not supported\n", (unsigned long) bytes); libpq_gettext("integer of size %lu not supported by pqPutInt\n"),
(unsigned long) bytes);
DONOTICE(conn, noticeBuf); DONOTICE(conn, noticeBuf);
return EOF; return EOF;
} }
...@@ -351,8 +352,8 @@ retry: ...@@ -351,8 +352,8 @@ retry:
goto retry; goto retry;
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqReadReady() -- select() failed: errno=%d\n%s\n", libpq_gettext("select() failed: %s\n"),
errno, strerror(errno)); strerror(errno));
return -1; return -1;
} }
...@@ -385,8 +386,8 @@ retry: ...@@ -385,8 +386,8 @@ retry:
goto retry; goto retry;
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqWriteReady() -- select() failed: errno=%d\n%s\n", libpq_gettext("select() failed: %s\n"),
errno, strerror(errno)); strerror(errno));
return -1; return -1;
} }
return FD_ISSET(conn->sock, &input_mask) ? 1 : 0; return FD_ISSET(conn->sock, &input_mask) ? 1 : 0;
...@@ -411,7 +412,7 @@ pqReadData(PGconn *conn) ...@@ -411,7 +412,7 @@ pqReadData(PGconn *conn)
if (conn->sock < 0) if (conn->sock < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqReadData() -- connection not open\n"); libpq_gettext("connection not open\n"));
return -1; return -1;
} }
...@@ -482,8 +483,8 @@ tryAgain: ...@@ -482,8 +483,8 @@ tryAgain:
goto definitelyFailed; goto definitelyFailed;
#endif #endif
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqReadData() -- read() failed: errno=%d\n%s\n", libpq_gettext("could not receive data from server: %s\n"),
errno, strerror(errno)); strerror(errno));
return -1; return -1;
} }
if (nread > 0) if (nread > 0)
...@@ -568,8 +569,8 @@ tryAgain2: ...@@ -568,8 +569,8 @@ tryAgain2:
goto definitelyFailed; goto definitelyFailed;
#endif #endif
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqReadData() -- read() failed: errno=%d\n%s\n", libpq_gettext("could not receive data from server: %s\n"),
errno, strerror(errno)); strerror(errno));
return -1; return -1;
} }
if (nread > 0) if (nread > 0)
...@@ -584,9 +585,10 @@ tryAgain2: ...@@ -584,9 +585,10 @@ tryAgain2:
*/ */
definitelyFailed: definitelyFailed:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqReadData() -- backend closed the channel unexpectedly.\n" libpq_gettext(
"\tThis probably means the backend terminated abnormally\n" "server closed the connection unexpectedly\n"
"\tbefore or while processing the request.\n"); "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n"));
conn->status = CONNECTION_BAD; /* No more connection to backend */ conn->status = CONNECTION_BAD; /* No more connection to backend */
#ifdef WIN32 #ifdef WIN32
closesocket(conn->sock); closesocket(conn->sock);
...@@ -610,7 +612,7 @@ pqFlush(PGconn *conn) ...@@ -610,7 +612,7 @@ pqFlush(PGconn *conn)
if (conn->sock < 0) if (conn->sock < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqFlush() -- connection not open\n"); libpq_gettext("connection not open\n"));
return EOF; return EOF;
} }
...@@ -627,7 +629,6 @@ pqFlush(PGconn *conn) ...@@ -627,7 +629,6 @@ pqFlush(PGconn *conn)
/* Prevent being SIGPIPEd if backend has closed the connection. */ /* Prevent being SIGPIPEd if backend has closed the connection. */
#ifndef WIN32 #ifndef WIN32
pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN); pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
#endif #endif
int sent; int sent;
...@@ -669,9 +670,10 @@ pqFlush(PGconn *conn) ...@@ -669,9 +670,10 @@ pqFlush(PGconn *conn)
case ECONNRESET: case ECONNRESET:
#endif #endif
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqFlush() -- backend closed the channel unexpectedly.\n" libpq_gettext(
"\tThis probably means the backend terminated abnormally" "server closed the connection unexpectedly\n"
" before or while processing the request.\n"); "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n"));
/* /*
* We used to close the socket here, but that's a bad * We used to close the socket here, but that's a bad
...@@ -685,8 +687,8 @@ pqFlush(PGconn *conn) ...@@ -685,8 +687,8 @@ pqFlush(PGconn *conn)
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqFlush() -- couldn't send data: errno=%d\n%s\n", libpq_gettext("could not send data to server: %s\n"),
errno, strerror(errno)); strerror(errno));
/* We don't assume it's a fatal error... */ /* We don't assume it's a fatal error... */
return EOF; return EOF;
} }
...@@ -751,7 +753,7 @@ pqWait(int forRead, int forWrite, PGconn *conn) ...@@ -751,7 +753,7 @@ pqWait(int forRead, int forWrite, PGconn *conn)
if (conn->sock < 0) if (conn->sock < 0)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqWait() -- connection not open\n"); libpq_gettext("connection not open\n"));
return EOF; return EOF;
} }
...@@ -772,8 +774,8 @@ retry: ...@@ -772,8 +774,8 @@ retry:
if (errno == EINTR) if (errno == EINTR)
goto retry; goto retry;
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
"pqWait() -- select() failed: errno=%d\n%s\n", libpq_gettext("select() failed: %s\n"),
errno, strerror(errno)); strerror(errno));
return EOF; return EOF;
} }
} }
...@@ -831,3 +833,20 @@ PQenv2encoding(void) ...@@ -831,3 +833,20 @@ PQenv2encoding(void)
} }
#endif /* MULTIBYTE */ #endif /* MULTIBYTE */
#ifdef ENABLE_NLS
char *
libpq_gettext(const char *msgid)
{
static int already_bound = 0;
if (!already_bound)
{
already_bound = 1;
bindtextdomain("libpq", LOCALEDIR);
}
return dgettext("libpq", msgid);
}
#endif /* ENABLE_NLS */
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-int.h,v 1.35 2001/07/06 19:04:23 petere Exp $ * $Id: libpq-int.h,v 1.36 2001/07/15 13:45:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -343,4 +343,14 @@ extern int pqWriteReady(PGconn *conn); ...@@ -343,4 +343,14 @@ extern int pqWriteReady(PGconn *conn);
*/ */
#define pqIsnonblocking(conn) ((conn)->nonblocking) #define pqIsnonblocking(conn) ((conn)->nonblocking)
#ifdef ENABLE_NLS
extern char * libpq_gettext(const char *msgid)
#ifdef __GNUC__
__attribute__((format_arg(1)))
#endif
;
#else
#define libpq_gettext(x) (x)
#endif
#endif /* LIBPQ_INT_H */ #endif /* LIBPQ_INT_H */
# $Header: /cvsroot/pgsql/src/interfaces/libpq/nls.mk,v 1.1 2001/07/15 13:45:04 petere Exp $
CATALOG_NAME := libpq
AVAIL_LANGUAGES := de
GETTEXT_FILES := fe-auth.c fe-connect.c fe-exec.c fe-lobj.c fe-misc.c
GETTEXT_TRIGGERS:= libpq_gettext
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