Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb559382

Browse files
committed
National language support for pg_dump and pg_restore. Combined with big
message clean up.
1 parent14807a3 commitb559382

15 files changed

+2061
-692
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.55 2001/04/03 08:52:59 pjw Exp $
11+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.56 2001/06/27 21:21:36 petere Exp $
1212
*
1313
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1414
*
@@ -31,7 +31,9 @@
3131
*-------------------------------------------------------------------------
3232
*/
3333

34+
#include"postgres_fe.h"
3435
#include"pg_dump.h"
36+
#include"pg_backup_archiver.h"
3537

3638
#include<ctype.h>
3739

@@ -44,7 +46,7 @@ static char **findParentsByOid(TableInfo *tbinfo, int numTables,
4446
InhInfo*inhinfo,intnumInherits,
4547
constchar*oid,
4648
int*numParents,
47-
int (**parentIndices)[]);
49+
int (**parentIndexes)[]);
4850
staticintfindTableByOid(TableInfo*tbinfo,intnumTables,constchar*oid);
4951
staticvoidflagInhAttrs(TableInfo*tbinfo,intnumTables,
5052
InhInfo*inhinfo,intnumInherits);
@@ -116,8 +118,7 @@ findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
116118
}
117119

118120
/* should never get here */
119-
fprintf(stderr,"failed sanity check, opr with oid %s was not found\n",
120-
oid);
121+
write_msg(NULL,"failed sanity check, operator with oid %s not found\n",oid);
121122

122123
/* no suitable operator name was found */
123124
return (NULL);
@@ -127,7 +128,7 @@ findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
127128
/*
128129
* findParentsByOid
129130
* given the oid of a class, return the names of its parent classes
130-
* and assign the number of parents, and parentindices to the last arguments.
131+
* and assign the number of parents, and parentindexes to the last arguments.
131132
*
132133
*
133134
* returns NULL if none
@@ -136,7 +137,7 @@ findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
136137
staticchar**
137138
findParentsByOid(TableInfo*tblinfo,intnumTables,
138139
InhInfo*inhinfo,intnumInherits,constchar*oid,
139-
int*numParentsPtr,int (**parentIndices)[])
140+
int*numParentsPtr,int (**parentIndexes)[])
140141
{
141142
inti,
142143
j;
@@ -157,7 +158,7 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
157158
if (numParents>0)
158159
{
159160
result= (char**)malloc(sizeof(char*)*numParents);
160-
(*parentIndices)=malloc(sizeof(int)*numParents);
161+
(*parentIndexes)=malloc(sizeof(int)*numParents);
161162
j=0;
162163
for (i=0;i<numInherits;i++)
163164
{
@@ -168,22 +169,27 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
168169
if (parentInd<0)
169170
{
170171
selfInd=findTableByOid(tblinfo,numTables,oid);
171-
fprintf(stderr,
172-
"failed sanity check, parent oid %s of table %s (oid %s) was not found\n",
173-
inhinfo[i].inhparent,
174-
(selfInd >=0) ?tblinfo[selfInd].relname :"",
175-
oid);
172+
if (selfInd >=0)
173+
write_msg(NULL,"failed sanity check, parent oid %s of table %s (oid %s) not found\n",
174+
inhinfo[i].inhparent,
175+
tblinfo[selfInd].relname,
176+
oid);
177+
else
178+
write_msg(NULL,"failed sanity check, parent oid %s of table (oid %s) not found\n",
179+
inhinfo[i].inhparent,
180+
oid);
181+
176182
exit(2);
177183
}
178-
(**parentIndices)[j]=parentInd;
184+
(**parentIndexes)[j]=parentInd;
179185
result[j++]=tblinfo[parentInd].relname;
180186
}
181187
}
182188
returnresult;
183189
}
184190
else
185191
{
186-
(*parentIndices)=NULL;
192+
(*parentIndexes)=NULL;
187193
returnNULL;
188194
}
189195
}
@@ -212,7 +218,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
212218
{
213219
if (argNum >=arraysize)
214220
{
215-
fprintf(stderr,"parseNumericArray: too many numbers\n");
221+
write_msg(NULL,"parseNumericArray: too many numbers\n");
216222
exit(2);
217223
}
218224
temp[j]='\0';
@@ -227,7 +233,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
227233
if (!(isdigit((unsignedchar)s)||s=='-')||
228234
j >=sizeof(temp)-1)
229235
{
230-
fprintf(stderr,"parseNumericArray: bogus number\n");
236+
write_msg(NULL,"parseNumericArray: bogus number\n");
231237
exit(2);
232238
}
233239
temp[j++]=s;
@@ -281,7 +287,7 @@ dumpSchema(Archive *fout,
281287
intnumInherits;
282288
intnumAggregates;
283289
intnumOperators;
284-
intnumIndices;
290+
intnumIndexes;
285291
TypeInfo*tinfo=NULL;
286292
FuncInfo*finfo=NULL;
287293
AggInfo*agginfo=NULL;
@@ -316,9 +322,9 @@ dumpSchema(Archive *fout,
316322
tblinfo=getTables(&numTables,finfo,numFuncs);
317323

318324
if (g_verbose)
319-
fprintf(stderr,"%s readingindices information %s\n",
325+
fprintf(stderr,"%s readingindexes information %s\n",
320326
g_comment_start,g_comment_end);
321-
indinfo=getIndices(&numIndices);
327+
indinfo=getIndexes(&numIndexes);
322328

323329
if (g_verbose)
324330
fprintf(stderr,"%s reading table inheritance information %s\n",
@@ -355,15 +361,15 @@ dumpSchema(Archive *fout,
355361
fprintf(stderr,"%s dumping out tables %s\n",
356362
g_comment_start,g_comment_end);
357363

358-
dumpTables(fout,tblinfo,numTables,indinfo,numIndices,inhinfo,numInherits,
364+
dumpTables(fout,tblinfo,numTables,indinfo,numIndexes,inhinfo,numInherits,
359365
tinfo,numTypes,tablename,aclsSkip,oids,schemaOnly,dataOnly);
360366

361367
if (fout&& !dataOnly)
362368
{
363369
if (g_verbose)
364-
fprintf(stderr,"%s dumping outindices %s\n",
370+
fprintf(stderr,"%s dumping outindexes %s\n",
365371
g_comment_start,g_comment_end);
366-
dumpIndices(fout,indinfo,numIndices,tblinfo,numTables,tablename);
372+
dumpIndexes(fout,indinfo,numIndexes,tblinfo,numTables,tablename);
367373
}
368374

369375
if (!tablename&& !dataOnly)
@@ -404,7 +410,7 @@ dumpSchema(Archive *fout,
404410
clearTypeInfo(tinfo,numTypes);
405411
clearFuncInfo(finfo,numFuncs);
406412
clearInhInfo(inhinfo,numInherits);
407-
clearIndInfo(indinfo,numIndices);
413+
clearIndInfo(indinfo,numIndexes);
408414
returntblinfo;
409415
}
410416

@@ -426,7 +432,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
426432
k;
427433
intparentInd;
428434
intinhAttrInd;
429-
int(*parentIndices)[];
435+
int(*parentIndexes)[];
430436
boolfoundAttr;/* Attr was found in a parent */
431437
boolfoundNotNull;/* Attr was NOT NULL in a parent */
432438
booldefaultsMatch;/* All non-empty defaults match */
@@ -451,7 +457,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
451457
inhinfo,numInherits,
452458
tblinfo[i].oid,
453459
&tblinfo[i].numParents,
454-
&parentIndices);
460+
&parentIndexes);
455461

456462
/*
457463
* For each attr, check the parent info: if no parent has
@@ -477,13 +483,13 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
477483

478484
for (k=0;k<tblinfo[i].numParents;k++)
479485
{
480-
parentInd= (*parentIndices)[k];
486+
parentInd= (*parentIndexes)[k];
481487

482488
if (parentInd<0)
483489
{
484490
/* shouldn't happen unless findParentsByOid is broken */
485-
fprintf(stderr,"failed sanity check, table%s not found by flagInhAttrs\n",
486-
tblinfo[i].parentRels[k]);
491+
write_msg(NULL,"failed sanity check, table\"%s\" not found by flagInhAttrs\n",
492+
tblinfo[i].parentRels[k]);
487493
exit(2);
488494
};
489495

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp