|
20 | 20 | *
|
21 | 21 | *
|
22 | 22 | * IDENTIFICATION
|
23 |
| - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.15 1996/11/17 04:56:01 momjian Exp $ |
| 23 | + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.16 1996/11/20 22:32:55 momjian Exp $ |
24 | 24 | *
|
25 | 25 | * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
26 | 26 | *
|
@@ -1456,31 +1456,36 @@ dumpClasses(TableInfo *tblinfo, int numTables, FILE *fout, const char *onlytable
|
1456 | 1456 | fprintf(fout,"values (");
|
1457 | 1457 | field=0;
|
1458 | 1458 | do {
|
1459 |
| -switch(PQftype(res,field)) { |
1460 |
| -case21:case22:case23:/* int types */ |
1461 |
| -case810:case910:/* oldint types */ |
1462 |
| -case1005:case1006:case1007:/* _int types */ |
1463 |
| -case700:case701:/* float types */ |
1464 |
| -case1021:case1022:/* _float types */ |
1465 |
| -fprintf(fout,"%s",PQgetvalue(res,tuple,field)); |
1466 |
| -break; |
1467 |
| -default: |
| 1459 | +if (PQgetisnull(res,tuple,field)) { |
| 1460 | +fprintf(fout,"NULL"); |
| 1461 | +} |
| 1462 | +else { |
| 1463 | +switch(PQftype(res,field)) { |
| 1464 | +case21:case22:case23:/* int types */ |
| 1465 | +case810:case910:/* oldint types */ |
| 1466 | +case1005:case1006:case1007:/* _int types */ |
| 1467 | +case700:case701:/* float types */ |
| 1468 | +case1021:case1022:/* _float types */ |
| 1469 | +fprintf(fout,"%s",PQgetvalue(res,tuple,field)); |
| 1470 | +break; |
| 1471 | +default: |
1468 | 1472 |
|
1469 |
| -/* Before outputing string value, expand all |
1470 |
| - single quotes to twin single quotes - |
1471 |
| - dhb - 6/11/96 */ |
1472 |
| -expsrc=PQgetvalue(res,tuple,field); |
1473 |
| -expdest=expandbuf; |
1474 |
| -while (*expsrc) { |
1475 |
| -*expdest++=*expsrc; |
1476 |
| -if (*expsrc== (char)0x27)/*sing. quote*/ |
1477 |
| -*expdest++=*expsrc; |
1478 |
| -expsrc++; |
1479 |
| - } |
1480 |
| -*expdest=*expsrc;/* null term. */ |
| 1473 | +/* Before outputing string value, expand all |
| 1474 | +single quotes to twin single quotes - |
| 1475 | +dhb - 6/11/96 */ |
| 1476 | +expsrc=PQgetvalue(res,tuple,field); |
| 1477 | +expdest=expandbuf; |
| 1478 | +while (*expsrc) { |
| 1479 | +*expdest++=*expsrc; |
| 1480 | +if (*expsrc== (char)0x27)/*sing. quote*/ |
| 1481 | +*expdest++=*expsrc; |
| 1482 | +expsrc++; |
| 1483 | +} |
| 1484 | +*expdest=*expsrc;/* null term. */ |
1481 | 1485 |
|
1482 |
| -fprintf(fout,"'%s'",expandbuf); |
1483 |
| -break; |
| 1486 | +fprintf(fout,"'%s'",expandbuf); |
| 1487 | +break; |
| 1488 | + } |
1484 | 1489 | }
|
1485 | 1490 | field++;
|
1486 | 1491 | if(field!=PQnfields(res))
|
|