Commit 30ab5bd4 authored by Peter Eisentraut's avatar Peter Eisentraut

More message munging and localization for pg_dump, especially the

--verbose messages, which had not been considered so far.  Output to the
terminal should okay now; comments written into the dump are still English
only, which may or may not be the desirable thing.
parent 3ec9fb89
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.56 2001/06/27 21:21:36 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.57 2001/07/03 20:21:47 petere Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
...@@ -179,7 +179,7 @@ findParentsByOid(TableInfo *tblinfo, int numTables, ...@@ -179,7 +179,7 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
inhinfo[i].inhparent, inhinfo[i].inhparent,
oid); oid);
exit(2); exit_nicely();
} }
(**parentIndexes)[j] = parentInd; (**parentIndexes)[j] = parentInd;
result[j++] = tblinfo[parentInd].relname; result[j++] = tblinfo[parentInd].relname;
...@@ -219,7 +219,7 @@ parseNumericArray(const char *str, char **array, int arraysize) ...@@ -219,7 +219,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
if (argNum >= arraysize) if (argNum >= arraysize)
{ {
write_msg(NULL, "parseNumericArray: too many numbers\n"); write_msg(NULL, "parseNumericArray: too many numbers\n");
exit(2); exit_nicely();
} }
temp[j] = '\0'; temp[j] = '\0';
array[argNum++] = strdup(temp); array[argNum++] = strdup(temp);
...@@ -234,7 +234,7 @@ parseNumericArray(const char *str, char **array, int arraysize) ...@@ -234,7 +234,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
j >= sizeof(temp) - 1) j >= sizeof(temp) - 1)
{ {
write_msg(NULL, "parseNumericArray: bogus number\n"); write_msg(NULL, "parseNumericArray: bogus number\n");
exit(2); exit_nicely();
} }
temp[j++] = s; temp[j++] = s;
} }
...@@ -297,69 +297,57 @@ dumpSchema(Archive *fout, ...@@ -297,69 +297,57 @@ dumpSchema(Archive *fout,
IndInfo *indinfo = NULL; IndInfo *indinfo = NULL;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined types %s\n", write_msg(NULL, "reading user-defined types\n");
g_comment_start, g_comment_end);
tinfo = getTypes(&numTypes); tinfo = getTypes(&numTypes);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined functions %s\n", write_msg(NULL, "reading user-defined functions\n");
g_comment_start, g_comment_end);
finfo = getFuncs(&numFuncs); finfo = getFuncs(&numFuncs);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined aggregates %s\n", write_msg(NULL, "reading user-defined aggregate functions\n");
g_comment_start, g_comment_end);
agginfo = getAggregates(&numAggregates); agginfo = getAggregates(&numAggregates);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined operators %s\n", write_msg(NULL, "reading user-defined operators\n");
g_comment_start, g_comment_end);
oprinfo = getOperators(&numOperators); oprinfo = getOperators(&numOperators);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined tables %s\n", write_msg(NULL, "reading user-defined tables\n");
g_comment_start, g_comment_end);
tblinfo = getTables(&numTables, finfo, numFuncs); tblinfo = getTables(&numTables, finfo, numFuncs);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading indexes information %s\n", write_msg(NULL, "reading index information\n");
g_comment_start, g_comment_end);
indinfo = getIndexes(&numIndexes); indinfo = getIndexes(&numIndexes);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading table inheritance information %s\n", write_msg(NULL, "reading table inheritance information\n");
g_comment_start, g_comment_end);
inhinfo = getInherits(&numInherits); inhinfo = getInherits(&numInherits);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding the attribute names and types for each table %s\n", write_msg(NULL, "finding the column names and types for each table\n");
g_comment_start, g_comment_end);
getTableAttrs(tblinfo, numTables); getTableAttrs(tblinfo, numTables);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s flagging inherited attributes in subtables %s\n", write_msg(NULL, "flagging inherited columns in subtables\n");
g_comment_start, g_comment_end);
flagInhAttrs(tblinfo, numTables, inhinfo, numInherits); flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out database comment %s\n", write_msg(NULL, "dumping out database comment\n");
g_comment_start, g_comment_end);
dumpDBComment(fout); dumpDBComment(fout);
} }
if (!tablename && fout) if (!tablename && fout)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined types %s\n", write_msg(NULL, "dumping out user-defined types\n");
g_comment_start, g_comment_end);
dumpTypes(fout, finfo, numFuncs, tinfo, numTypes); dumpTypes(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out tables %s\n", write_msg(NULL, "dumping out tables\n");
g_comment_start, g_comment_end);
dumpTables(fout, tblinfo, numTables, indinfo, numIndexes, inhinfo, numInherits, dumpTables(fout, tblinfo, numTables, indinfo, numIndexes, inhinfo, numInherits,
tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly); tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly);
...@@ -367,40 +355,35 @@ dumpSchema(Archive *fout, ...@@ -367,40 +355,35 @@ dumpSchema(Archive *fout,
if (fout && !dataOnly) if (fout && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out indexes %s\n", write_msg(NULL, "dumping out indexes\n");
g_comment_start, g_comment_end);
dumpIndexes(fout, indinfo, numIndexes, tblinfo, numTables, tablename); dumpIndexes(fout, indinfo, numIndexes, tblinfo, numTables, tablename);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined procedural languages %s\n", write_msg(NULL, "dumping out user-defined procedural languages\n");
g_comment_start, g_comment_end);
dumpProcLangs(fout, finfo, numFuncs, tinfo, numTypes); dumpProcLangs(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined functions %s\n", write_msg(NULL, "dumping out user-defined functions\n");
g_comment_start, g_comment_end);
dumpFuncs(fout, finfo, numFuncs, tinfo, numTypes); dumpFuncs(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined aggregates %s\n", write_msg(NULL, "dumping out user-defined aggregate functions\n");
g_comment_start, g_comment_end);
dumpAggs(fout, agginfo, numAggregates, tinfo, numTypes); dumpAggs(fout, agginfo, numAggregates, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined operators %s\n", write_msg(NULL, "dumping out user-defined operators\n");
g_comment_start, g_comment_end);
dumpOprs(fout, oprinfo, numOperators, tinfo, numTypes); dumpOprs(fout, oprinfo, numOperators, tinfo, numTypes);
} }
...@@ -490,7 +473,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables, ...@@ -490,7 +473,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
/* shouldn't happen unless findParentsByOid is broken */ /* shouldn't happen unless findParentsByOid is broken */
write_msg(NULL, "failed sanity check, table \"%s\" not found by flagInhAttrs\n", write_msg(NULL, "failed sanity check, table \"%s\" not found by flagInhAttrs\n",
tblinfo[i].parentRels[k]); tblinfo[i].parentRels[k]);
exit(2); exit_nicely();
}; };
inhAttrInd = strInArray(tblinfo[i].attnames[j], inhAttrInd = strInArray(tblinfo[i].attnames[j],
......
This diff is collapsed.
# $Header: /cvsroot/pgsql/src/bin/pg_dump/nls.mk,v 1.1 2001/06/27 21:21:37 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/pg_dump/nls.mk,v 1.2 2001/07/03 20:21:48 petere Exp $
CATALOG_NAME := pg_dump CATALOG_NAME := pg_dump
AVAIL_LANGUAGES := de AVAIL_LANGUAGES := de
GETTEXT_FILES := pg_dump.c common.c pg_backup_archiver.c pg_backup_custom.c \ GETTEXT_FILES := pg_dump.c common.c pg_backup_archiver.c pg_backup_custom.c \
pg_backup_db.c pg_backup_files.c pg_backup_null.c \ pg_backup_db.c pg_backup_files.c pg_backup_null.c \
pg_backup_tar.c pg_restore.c pg_backup_tar.c pg_restore.c
GETTEXT_TRIGGERS:= write_msg:2 die_horribly:3 exit_horribly:3 simple_prompt \ GETTEXT_TRIGGERS:= write_msg:2 die_horribly:3 exit_horribly:3 simple_prompt \
ExecuteSqlCommand:3 ExecuteSqlCommand:3 ahlog:3
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.28 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.29 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
...@@ -91,7 +91,7 @@ static void _fixupOidInfo(TocEntry *te); ...@@ -91,7 +91,7 @@ static void _fixupOidInfo(TocEntry *te);
static Oid _findMaxOID(const char *((*deps)[])); static Oid _findMaxOID(const char *((*deps)[]));
const char *progname; const char *progname;
static char *modulename = "archiver"; static char *modulename = gettext_noop("archiver");
static void _write_msg(const char *modulename, const char *fmt, va_list ap); static void _write_msg(const char *modulename, const char *fmt, va_list ap);
static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap); static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap);
...@@ -170,7 +170,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -170,7 +170,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/ */
if (ropt->useDB) if (ropt->useDB)
{ {
ahlog(AH, 1, "Connecting to database for restore\n"); ahlog(AH, 1, "connecting to database for restore\n");
if (AH->version < K_VERS_1_3) if (AH->version < K_VERS_1_3)
die_horribly(AH, modulename, "direct database connections are not supported in pre-1.3 archives\n"); die_horribly(AH, modulename, "direct database connections are not supported in pre-1.3 archives\n");
...@@ -219,7 +219,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -219,7 +219,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if (impliedDataOnly) if (impliedDataOnly)
{ {
ropt->dataOnly = impliedDataOnly; ropt->dataOnly = impliedDataOnly;
ahlog(AH, 1, "Implied data-only restore\n"); ahlog(AH, 1, "implied data-only restore\n");
} }
} }
...@@ -247,8 +247,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -247,8 +247,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
{ {
reqs = _tocEntryRequired(te, ropt); reqs = _tocEntryRequired(te, ropt);
if (((reqs & 1) != 0) && te->dropStmt) if (((reqs & 1) != 0) && te->dropStmt)
{ /* We want the schema */ {
ahlog(AH, 1, "Dropping %s %s\n", te->desc, te->name); /* We want the schema */
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->name);
/* Reconnect if necessary */ /* Reconnect if necessary */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
/* Drop it */ /* Drop it */
...@@ -284,14 +285,14 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -284,14 +285,14 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/* Reconnect if necessary */ /* Reconnect if necessary */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
ahlog(AH, 1, "Creating %s %s\n", te->desc, te->name); ahlog(AH, 1, "creating %s %s\n", te->desc, te->name);
_printTocEntry(AH, te, ropt, false); _printTocEntry(AH, te, ropt, false);
defnDumped = true; defnDumped = true;
/* If we created a DB, connect to it... */ /* If we created a DB, connect to it... */
if (strcmp(te->desc, "DATABASE") == 0) if (strcmp(te->desc, "DATABASE") == 0)
{ {
ahlog(AH, 1, "Connecting to new DB '%s' as %s\n", te->name, te->owner); ahlog(AH, 1, "connecting to new database %s as user %s\n", te->name, te->owner);
_reconnectAsUser(AH, te->name, te->owner); _reconnectAsUser(AH, te->name, te->owner);
} }
} }
...@@ -346,7 +347,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -346,7 +347,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/ */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
ahlog(AH, 1, "Restoring data for %s \n", te->name); ahlog(AH, 1, "restoring data for table %s\n", te->name);
/* /*
* If we have a copy statement, use it. As of V1.3, these * If we have a copy statement, use it. As of V1.3, these
...@@ -367,7 +368,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -367,7 +368,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
} }
} else if (!defnDumped) { } else if (!defnDumped) {
/* If we haven't already dumped the defn part, do so now */ /* If we haven't already dumped the defn part, do so now */
ahlog(AH, 1, "Executing %s %s\n", te->desc, te->name); ahlog(AH, 1, "executing %s %s\n", te->desc, te->name);
_printTocEntry(AH, te, ropt, false); _printTocEntry(AH, te, ropt, false);
} }
} }
...@@ -391,18 +392,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ...@@ -391,18 +392,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if (strcmp(te->desc, "TABLE DATA") == 0) if (strcmp(te->desc, "TABLE DATA") == 0)
{ {
ahlog(AH, 2, "Checking if we loaded %s\n", te->name); ahlog(AH, 2, "checking whether we loaded %s\n", te->name);
reqs = _tocEntryRequired(te, ropt); reqs = _tocEntryRequired(te, ropt);
if ((reqs & 2) != 0) /* We loaded the data */ if ((reqs & 2) != 0) /* We loaded the data */
{ {
ahlog(AH, 1, "Fixing up BLOB ref for %s\n", te->name); ahlog(AH, 1, "fixing up BLOB reference for %s\n", te->name);
FixupBlobRefs(AH, te->name); FixupBlobRefs(AH, te->name);
} }
} }
else else
ahlog(AH, 2, "Ignoring BLOB xrefs for %s %s\n", te->desc, te->name); ahlog(AH, 2, "ignoring BLOB cross-references for %s %s\n", te->desc, te->name);
te = te->next; te = te->next;
} }
...@@ -489,7 +490,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop ...@@ -489,7 +490,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
} }
} }
ahlog(AH, 1, "Disabling triggers\n"); ahlog(AH, 1, "disabling triggers\n");
/* /*
* Disable them. This is a hack. Needs to be done via an appropriate * Disable them. This is a hack. Needs to be done via an appropriate
...@@ -549,7 +550,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt ...@@ -549,7 +550,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
} }
} }
ahlog(AH, 1, "Enabling triggers\n"); ahlog(AH, 1, "enabling triggers\n");
/* /*
* Enable them. This is a hack. Needs to be done via an appropriate * Enable them. This is a hack. Needs to be done via an appropriate
...@@ -752,14 +753,14 @@ EndRestoreBlobs(ArchiveHandle *AH) ...@@ -752,14 +753,14 @@ EndRestoreBlobs(ArchiveHandle *AH)
{ {
if (AH->txActive) if (AH->txActive)
{ {
ahlog(AH, 2, "Committing BLOB transactions\n"); ahlog(AH, 2, "committing BLOB transactions\n");
CommitTransaction(AH); CommitTransaction(AH);
} }
if (AH->blobTxActive) if (AH->blobTxActive)
CommitTransactionXref(AH); CommitTransactionXref(AH);
ahlog(AH, 1, "Restored %d BLOBs\n", AH->blobCount); ahlog(AH, 1, "restored %d BLOBs\n", AH->blobCount);
} }
...@@ -769,7 +770,7 @@ EndRestoreBlobs(ArchiveHandle *AH) ...@@ -769,7 +770,7 @@ EndRestoreBlobs(ArchiveHandle *AH)
void void
StartRestoreBlob(ArchiveHandle *AH, Oid oid) StartRestoreBlob(ArchiveHandle *AH, Oid oid)
{ {
int loOid; Oid loOid;
AH->blobCount++; AH->blobCount++;
...@@ -787,7 +788,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid) ...@@ -787,7 +788,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid)
*/ */
if (!AH->txActive) if (!AH->txActive)
{ {
ahlog(AH, 2, "Starting BLOB transactions\n"); ahlog(AH, 2, "starting BLOB transactions\n");
StartTransaction(AH); StartTransaction(AH);
} }
if (!AH->blobTxActive) if (!AH->blobTxActive)
...@@ -797,7 +798,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid) ...@@ -797,7 +798,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid)
if (loOid == 0) if (loOid == 0)
die_horribly(AH, modulename, "could not create BLOB\n"); die_horribly(AH, modulename, "could not create BLOB\n");
ahlog(AH, 2, "Restoring BLOB oid %d as %d\n", oid, loOid); ahlog(AH, 2, "restoring BLOB oid %u as %u\n", oid, loOid);
InsertBlobXref(AH, oid, loOid); InsertBlobXref(AH, oid, loOid);
...@@ -819,7 +820,7 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid) ...@@ -819,7 +820,7 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid)
*/ */
if (((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount) if (((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount)
{ {
ahlog(AH, 2, "Committing BLOB transactions\n"); ahlog(AH, 2, "committing BLOB transactions\n");
CommitTransaction(AH); CommitTransaction(AH);
CommitTransactionXref(AH); CommitTransactionXref(AH);
} }
...@@ -1166,7 +1167,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,...) ...@@ -1166,7 +1167,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,...)
return; return;
va_start(ap, fmt); va_start(ap, fmt);
vfprintf(stderr, fmt, ap); _write_msg(NULL, fmt, ap);
va_end(ap); va_end(ap);
} }
...@@ -1193,7 +1194,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH) ...@@ -1193,7 +1194,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
if (AH->writingBlob) if (AH->writingBlob)
{ {
res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb); res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb);
ahlog(AH, 5, "Wrote %d bytes of BLOB data (result = %d)\n", size * nmemb, res); ahlog(AH, 5, "wrote %d bytes of BLOB data (result = %d)\n", size * nmemb, res);
if (res < size * nmemb) if (res < size * nmemb)
die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n", die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n",
res, size * nmemb); res, size * nmemb);
...@@ -1239,7 +1240,7 @@ static void ...@@ -1239,7 +1240,7 @@ static void
_write_msg(const char *modulename, const char *fmt, va_list ap) _write_msg(const char *modulename, const char *fmt, va_list ap)
{ {
if (modulename) if (modulename)
fprintf(stderr, "%s[%s]: ", progname, gettext(modulename)); fprintf(stderr, "%s: [%s] ", progname, gettext(modulename));
else else
fprintf(stderr, "%s: ", progname); fprintf(stderr, "%s: ", progname);
vfprintf(stderr, gettext(fmt), ap); vfprintf(stderr, gettext(fmt), ap);
...@@ -1260,6 +1261,8 @@ static void ...@@ -1260,6 +1261,8 @@ static void
_die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap) _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap)
{ {
_write_msg(modulename, fmt, ap); _write_msg(modulename, fmt, ap);
if (AH->public.verbose)
write_msg(NULL, "*** aborted because of error\n");
if (AH) if (AH)
if (AH->connection) if (AH->connection)
...@@ -1813,7 +1816,7 @@ ReadToc(ArchiveHandle *AH) ...@@ -1813,7 +1816,7 @@ ReadToc(ArchiveHandle *AH)
if (AH->ReadExtraTocPtr) if (AH->ReadExtraTocPtr)
(*AH->ReadExtraTocPtr) (AH, te); (*AH->ReadExtraTocPtr) (AH, te);
ahlog(AH, 3, "Read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->name); ahlog(AH, 3, "read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->name);
te->prev = AH->toc->prev; te->prev = AH->toc->prev;
AH->toc->prev->next = te; AH->toc->prev->next = te;
...@@ -2052,7 +2055,7 @@ ReadHead(ArchiveHandle *AH) ...@@ -2052,7 +2055,7 @@ ReadHead(ArchiveHandle *AH)
AH->createDate = mktime(&crtm); AH->createDate = mktime(&crtm);
if (AH->createDate == (time_t) -1) if (AH->createDate == (time_t) -1)
write_msg(modulename, "WARNING: bad creation date in header\n"); write_msg(modulename, "WARNING: invalid creation date in header\n");
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.35 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.36 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* - Initial version. * - Initial version.
...@@ -316,8 +316,8 @@ extern char *ConnectedUser(ArchiveHandle *AH); ...@@ -316,8 +316,8 @@ extern char *ConnectedUser(ArchiveHandle *AH);
extern int ConnectedUserIsSuperuser(ArchiveHandle *AH); extern int ConnectedUserIsSuperuser(ArchiveHandle *AH);
int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH); int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH);
int ahprintf(ArchiveHandle *AH, const char *fmt,...); int ahprintf(ArchiveHandle *AH, const char *fmt,...) __attribute__((format(printf,2,3)));
void ahlog(ArchiveHandle *AH, int level, const char *fmt,...); void ahlog(ArchiveHandle *AH, int level, const char *fmt,...) __attribute__((format(printf,3,4)));
#endif #endif
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.12 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.13 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
...@@ -102,7 +102,7 @@ static void _EndDataCompressor(ArchiveHandle *AH, TocEntry *te); ...@@ -102,7 +102,7 @@ static void _EndDataCompressor(ArchiveHandle *AH, TocEntry *te);
static int _getFilePos(ArchiveHandle *AH, lclContext *ctx); static int _getFilePos(ArchiveHandle *AH, lclContext *ctx);
static int _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush); static int _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush);
static char *modulename = "custom archiver"; static char *modulename = gettext_noop("custom archiver");
...@@ -193,7 +193,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH) ...@@ -193,7 +193,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
else else
AH->FH = stdin; AH->FH = stdin;
if (!AH->FH) if (!AH->FH)
die_horribly(AH, modulename, "could not open archive file %s: %s", AH->fSpec, strerror(errno)); die_horribly(AH, modulename, "could not open archive file %s: %s\n", AH->fSpec, strerror(errno));
ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0); ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver. * Implements the basic DB functions used by the archiver.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.20 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.21 2001/07/03 20:21:48 petere Exp $
* *
* NOTES * NOTES
* *
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "pg_dump.h"
#include "pg_backup.h" #include "pg_backup.h"
#include "pg_backup_archiver.h" #include "pg_backup_archiver.h"
#include "pg_backup_db.h" #include "pg_backup_db.h"
...@@ -38,7 +37,7 @@ ...@@ -38,7 +37,7 @@
#include "strdup.h" #include "strdup.h"
#endif #endif
static const char *modulename = "archiver (db)"; static const char *modulename = gettext_noop("archiver (db)");
static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion); static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion);
static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser); static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser);
...@@ -275,7 +274,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser) ...@@ -275,7 +274,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser)
else else
newuser = (char *) requser; newuser = (char *) requser;
ahlog(AH, 1, "Connecting to %s as %s\n", newdb, newuser); ahlog(AH, 1, "connecting to database %s as user %s\n", newdb, newuser);
if (AH->requirePassword) if (AH->requirePassword)
{ {
...@@ -347,7 +346,7 @@ ConnectDatabase(Archive *AHX, ...@@ -347,7 +346,7 @@ ConnectDatabase(Archive *AHX,
bool need_pass = false; bool need_pass = false;
if (AH->connection) if (AH->connection)
die_horribly(AH, modulename, "already connected to database\n"); die_horribly(AH, modulename, "already connected to a database\n");
if (!dbname && !(dbname = getenv("PGDATABASE"))) if (!dbname && !(dbname = getenv("PGDATABASE")))
die_horribly(AH, modulename, "no database name specified\n"); die_horribly(AH, modulename, "no database name specified\n");
...@@ -449,7 +448,7 @@ _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc) ...@@ -449,7 +448,7 @@ _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc)
/* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */ /* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */
res = PQexec(conn, qry->data); res = PQexec(conn, qry->data);
if (!res) if (!res)
die_horribly(AH, modulename, "%s: no result from backend\n", desc); die_horribly(AH, modulename, "%s: no result from server\n", desc);
if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
...@@ -701,7 +700,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename) ...@@ -701,7 +700,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
if ((n = PQntuples(res)) == 0) if ((n = PQntuples(res)) == 0)
{ {
/* We're done */ /* We're done */
ahlog(AH, 1, "No OID attributes in table %s\n", tablename); ahlog(AH, 1, "no OID type columns in table %s\n", tablename);
PQclear(res); PQclear(res);
return; return;
} }
...@@ -710,7 +709,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename) ...@@ -710,7 +709,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
{ {
attr = PQgetvalue(res, i, 0); attr = PQgetvalue(res, i, 0);
ahlog(AH, 1, " - %s.%s\n", tablename, attr); ahlog(AH, 1, "fixing BLOB cross-references for %s.%s\n", tablename, attr);
resetPQExpBuffer(tblQry); resetPQExpBuffer(tblQry);
...@@ -725,7 +724,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename) ...@@ -725,7 +724,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
"(select * from %s x where x.oldOid = \"%s\".\"%s\");", "(select * from %s x where x.oldOid = \"%s\".\"%s\");",
BLOB_XREF_TABLE, tablename, attr); BLOB_XREF_TABLE, tablename, attr);
ahlog(AH, 10, " - sql:\n%s\n", tblQry->data); ahlog(AH, 10, "SQL: %s\n", tblQry->data);
uRes = PQexec(AH->blobConnection, tblQry->data); uRes = PQexec(AH->blobConnection, tblQry->data);
if (!uRes) if (!uRes)
...@@ -757,7 +756,7 @@ CreateBlobXrefTable(ArchiveHandle *AH) ...@@ -757,7 +756,7 @@ CreateBlobXrefTable(ArchiveHandle *AH)
if (!AH->blobConnection) if (!AH->blobConnection)
AH->blobConnection = _connectDB(AH, NULL, NULL); AH->blobConnection = _connectDB(AH, NULL, NULL);
ahlog(AH, 1, "Creating table for BLOBS xrefs\n"); ahlog(AH, 1, "creating table for BLOB cross-references\n");
appendPQExpBuffer(qry, "Create Temporary Table %s(oldOid oid, newOid oid);", BLOB_XREF_TABLE); appendPQExpBuffer(qry, "Create Temporary Table %s(oldOid oid, newOid oid);", BLOB_XREF_TABLE);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.11 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.12 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
...@@ -74,7 +74,7 @@ typedef struct ...@@ -74,7 +74,7 @@ typedef struct
char *filename; char *filename;
} lclTocEntry; } lclTocEntry;
static char *modulename = "file archiver"; static char *modulename = gettext_noop("file archiver");
static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt); static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
static void _getBlobTocEntry(ArchiveHandle *AH, int *oid, char *fname); static void _getBlobTocEntry(ArchiveHandle *AH, int *oid, char *fname);
...@@ -120,7 +120,7 @@ InitArchiveFmt_Files(ArchiveHandle *AH) ...@@ -120,7 +120,7 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
{ {
write_msg(modulename, "WARNING:\n" write_msg(modulename, "WARNING:\n"
" This format is for demonstration purposes, it is not intended for\n" " This format is for demonstration purposes; it is not intended for\n"
" normal use. Files will be written in the current working directory.\n"); " normal use. Files will be written in the current working directory.\n");
if (AH->fSpec && strcmp(AH->fSpec, "") != 0) if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.16 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.17 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
...@@ -101,7 +101,7 @@ typedef struct ...@@ -101,7 +101,7 @@ typedef struct
char *filename; char *filename;
} lclTocEntry; } lclTocEntry;
static char *modulename = "tar archiver"; static char *modulename = gettext_noop("tar archiver");
static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt); static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
...@@ -698,7 +698,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt) ...@@ -698,7 +698,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
static void static void
_LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt) _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
{ {
int oid; Oid oid;
lclContext *ctx = (lclContext *) AH->formatData; lclContext *ctx = (lclContext *) AH->formatData;
TAR_MEMBER *th; TAR_MEMBER *th;
int cnt; int cnt;
...@@ -711,11 +711,11 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt) ...@@ -711,11 +711,11 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
{ {
ctx->FH = th; ctx->FH = th;
oid = atoi(&th->targetFile[5]); oid = (Oid)strtoul(&th->targetFile[5], NULL, 10);
if (strncmp(th->targetFile, "blob_", 5) == 0 && oid != 0) if (strncmp(th->targetFile, "blob_", 5) == 0 && oid != 0)
{ {
ahlog(AH, 1, " - Restoring BLOB oid %d\n", oid); ahlog(AH, 1, "restoring BLOB oid %u\n", oid);
StartRestoreBlob(AH, oid); StartRestoreBlob(AH, oid);
...@@ -1088,7 +1088,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename) ...@@ -1088,7 +1088,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
/* Go to end of current file, if any */ /* Go to end of current file, if any */
if (ctx->tarFHpos != 0) if (ctx->tarFHpos != 0)
{ {
ahlog(AH, 4, "Moving from %d (%x) to next member at file position %d (%x)\n", ahlog(AH, 4, "moving from position %d (%x) to next member at file position %d (%x)\n",
ctx->tarFHpos, ctx->tarFHpos, ctx->tarFHpos, ctx->tarFHpos,
ctx->tarNextMember, ctx->tarNextMember); ctx->tarNextMember, ctx->tarNextMember);
...@@ -1096,7 +1096,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename) ...@@ -1096,7 +1096,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
_tarReadRaw(AH, &c, 1, NULL, ctx->tarFH); _tarReadRaw(AH, &c, 1, NULL, ctx->tarFH);
} }
ahlog(AH, 4, "Now at file position %d (%x)\n", ctx->tarFHpos, ctx->tarFHpos); ahlog(AH, 4, "now at file position %d (%x)\n", ctx->tarFHpos, ctx->tarFHpos);
/* We are at the start of the file. or at the next member */ /* We are at the start of the file. or at the next member */
...@@ -1115,7 +1115,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename) ...@@ -1115,7 +1115,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
while (filename != NULL && strcmp(th->targetFile, filename) != 0) while (filename != NULL && strcmp(th->targetFile, filename) != 0)
{ {
ahlog(AH, 4, "Skipping member %s\n", th->targetFile); ahlog(AH, 4, "skipping tar member %s\n", th->targetFile);
id = atoi(th->targetFile); id = atoi(th->targetFile);
if ((TocIDRequired(AH, id, AH->ropt) & 2) != 0) if ((TocIDRequired(AH, id, AH->ropt) & 2) != 0)
...@@ -1202,7 +1202,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) ...@@ -1202,7 +1202,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
sscanf(&h[124], "%12o", &len); sscanf(&h[124], "%12o", &len);
sscanf(&h[148], "%8o", &sum); sscanf(&h[148], "%8o", &sum);
ahlog(AH, 3, "TOC Entry %s at %d (len=%d, chk=%d)\n", &name[0], hPos, len, sum); ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &name[0], hPos, len, sum);
if (chk != sum) if (chk != sum)
die_horribly(AH, modulename, die_horribly(AH, modulename,
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,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: pg_dump.h,v 1.64 2001/06/27 21:21:37 petere Exp $ * $Id: pg_dump.h,v 1.65 2001/07/03 20:21:50 petere Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
...@@ -275,5 +275,6 @@ extern void dumpTables(Archive *fout, TableInfo *tbinfo, int numTables, ...@@ -275,5 +275,6 @@ extern void dumpTables(Archive *fout, TableInfo *tbinfo, int numTables,
extern void dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes, extern void dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
TableInfo *tbinfo, int numTables, const char *tablename); TableInfo *tbinfo, int numTables, const char *tablename);
extern const char *fmtId(const char *identifier, bool force_quotes); extern const char *fmtId(const char *identifier, bool force_quotes);
extern void exit_nicely(void);
#endif /* PG_DUMP_H */ #endif /* PG_DUMP_H */
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.21 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.22 2001/07/03 20:21:50 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
...@@ -248,7 +248,7 @@ main(int argc, char **argv) ...@@ -248,7 +248,7 @@ main(int argc, char **argv)
case 'u': case 'u':
opts->requirePassword = true; opts->requirePassword = true;
opts->username = simple_prompt("Username: ", 100, true); opts->username = simple_prompt("User name: ", 100, true);
break; break;
case 'U': case 'U':
......
...@@ -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: c.h,v 1.95 2001/06/03 14:53:56 petere Exp $ * $Id: c.h,v 1.96 2001/07/03 20:21:50 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
#else #else
#define gettext(x) (x) #define gettext(x) (x)
#endif #endif
#define gettext_noop(x) (x)
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* Section 1: hacks to cope with non-ANSI C compilers * Section 1: hacks to cope with non-ANSI C compilers
......
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