Commit f52c5165 authored by Tom Lane's avatar Tom Lane

Fix lo_export usage in example programs.

lo_export returns -1, not zero, on failure.
parent 0e924c00
...@@ -251,7 +251,7 @@ main(int argc, char **argv) ...@@ -251,7 +251,7 @@ main(int argc, char **argv)
printf("exporting large object to file \"%s\" ...\n", out_filename); printf("exporting large object to file \"%s\" ...\n", out_filename);
/* exportFile(conn, lobjOid, out_filename); */ /* exportFile(conn, lobjOid, out_filename); */
if (!lo_export(conn, lobjOid, out_filename)) if (lo_export(conn, lobjOid, out_filename) < 0)
fprintf(stderr, "%s\n", PQerrorMessage(conn)); fprintf(stderr, "%s\n", PQerrorMessage(conn));
} }
......
...@@ -275,14 +275,14 @@ main(int argc, char **argv) ...@@ -275,14 +275,14 @@ main(int argc, char **argv)
printf("exporting large object to file \"%s\" ...\n", out_filename); printf("exporting large object to file \"%s\" ...\n", out_filename);
/* exportFile(conn, lobjOid, out_filename); */ /* exportFile(conn, lobjOid, out_filename); */
if (!lo_export(conn, lobjOid, out_filename)) if (lo_export(conn, lobjOid, out_filename) < 0)
fprintf(stderr, "%s\n", PQerrorMessage(conn)); fprintf(stderr, "%s\n", PQerrorMessage(conn));
printf("truncating to 3294968000 bytes\n"); printf("truncating to 3294968000 bytes\n");
my_truncate(conn, lobjOid, 3294968000U); my_truncate(conn, lobjOid, 3294968000U);
printf("exporting truncated large object to file \"%s\" ...\n", out_filename2); printf("exporting truncated large object to file \"%s\" ...\n", out_filename2);
if (!lo_export(conn, lobjOid, out_filename2)) if (lo_export(conn, lobjOid, out_filename2) < 0)
fprintf(stderr, "%s\n", PQerrorMessage(conn)); fprintf(stderr, "%s\n", PQerrorMessage(conn));
} }
......
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