Skip to content

Commit 35a952a

Browse files
committed
Fixes from Jody Winston
1 parent a5d80cb commit 35a952a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/test/examples/testlo.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.1.1.1 1996/07/09 06:22:23 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.2 1997/07/10 01:15:11 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414
#include <stdio.h>
15+
#include <stdlib.h>
16+
17+
#include <sys/types.h>
18+
#include <sys/stat.h>
19+
#include <fcntl.h>
20+
1521
#include "libpq-fe.h"
1622
#include "libpq/libpq-fs.h"
1723

@@ -210,7 +216,11 @@ main(int argc, char **argv)
210216
PQclear(res);
211217
printf("importing file \"%s\" ...\n", in_filename);
212218
/* lobjOid = importFile(conn, in_filename); */
213-
lobjOid = lo_import(conn, in_filename);
219+
lobjOid = lo_import(conn, in_filename);
220+
if (lobjOid == 0)
221+
{
222+
fprintf(stderr,"%s\n",PQerrorMessage(conn));
223+
}
214224
/*
215225
printf("\tas large object %d.\n", lobjOid);
216226
@@ -223,7 +233,10 @@ main(int argc, char **argv)
223233

224234
printf("exporting large object to file \"%s\" ...\n", out_filename);
225235
/* exportFile(conn, lobjOid, out_filename); */
226-
lo_export(conn, lobjOid,out_filename);
236+
if (!lo_export(conn, lobjOid,out_filename))
237+
{
238+
fprintf(stderr,"%s\n",PQerrorMessage(conn));
239+
}
227240

228241
res = PQexec(conn, "end");
229242
PQclear(res);

0 commit comments

Comments
 (0)