7
7
*
8
8
*
9
9
* 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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
14
14
#include <stdio.h>
15
+ #include <stdlib.h>
16
+
17
+ #include <sys/types.h>
18
+ #include <sys/stat.h>
19
+ #include <fcntl.h>
20
+
15
21
#include "libpq-fe.h"
16
22
#include "libpq/libpq-fs.h"
17
23
@@ -210,7 +216,11 @@ main(int argc, char **argv)
210
216
PQclear (res );
211
217
printf ("importing file \"%s\" ...\n" , in_filename );
212
218
/* 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
+ }
214
224
/*
215
225
printf("\tas large object %d.\n", lobjOid);
216
226
@@ -223,7 +233,10 @@ main(int argc, char **argv)
223
233
224
234
printf ("exporting large object to file \"%s\" ...\n" , out_filename );
225
235
/* 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
+ }
227
240
228
241
res = PQexec (conn , "end" );
229
242
PQclear (res );
0 commit comments