diff options
author | Tom Lane | 2006-03-02 21:49:19 +0000 |
---|---|---|
committer | Tom Lane | 2006-03-02 21:49:19 +0000 |
commit | 7048c0090fbae64190a5f33e647ad25c2a62d205 (patch) | |
tree | 93a2a7d77d8024d21527187977afb49d2eb95754 | |
parent | 005439889d29ea61360d2e0af4102ff9900ff572 (diff) |
Fix ancient error in large objects usage example: overwrite() subroutine
was opening with INV_READ flag and then writing. Prior to 8.1 the backend
did not reject this, but now it does.
-rw-r--r-- | doc/src/sgml/lobj.sgml | 9 | ||||
-rw-r--r-- | src/test/examples/testlo.c | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/doc/src/sgml/lobj.sgml b/doc/src/sgml/lobj.sgml index 123411f115..11463b28ea 100644 --- a/doc/src/sgml/lobj.sgml +++ b/doc/src/sgml/lobj.sgml @@ -527,7 +527,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len) int nwritten; int i; - lobj_fd = lo_open(conn, lobjId, INV_READ); + lobj_fd = lo_open(conn, lobjId, INV_WRITE); if (lobj_fd < 0) { fprintf(stderr, "can't open large object %d\n", @@ -553,7 +553,8 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len) } /* - * exportFile * export large object "lobjOid" to file "out_filename" + * exportFile + * export large object "lobjOid" to file "out_filename" * */ void @@ -566,7 +567,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename) int fd; /* - * create an inversion "object" + * open the large object */ lobj_fd = lo_open(conn, lobjId, INV_READ); if (lobj_fd < 0) @@ -586,7 +587,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename) } /* - * read in from the Unix file and write to the inversion file + * read in from the inversion file and write to the Unix file */ while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) > 0) { diff --git a/src/test/examples/testlo.c b/src/test/examples/testlo.c index 367986135f..cdd0cde437 100644 --- a/src/test/examples/testlo.c +++ b/src/test/examples/testlo.c @@ -113,7 +113,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len) int nwritten; int i; - lobj_fd = lo_open(conn, lobjId, INV_READ); + lobj_fd = lo_open(conn, lobjId, INV_WRITE); if (lobj_fd < 0) fprintf(stderr, "can't open large object %u", lobjId); @@ -156,7 +156,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename) int fd; /* - * create an inversion "object" + * open the large object */ lobj_fd = lo_open(conn, lobjId, INV_READ); if (lobj_fd < 0) @@ -173,7 +173,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename) } /* - * read in from the Unix file and write to the inversion file + * read in from the inversion file and write to the Unix file */ while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) > 0) { |