Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56aa84a

Browse files
committed
Fix ancient error in large objects usage example: overwrite() subroutine
was opening with INV_READ flag and then writing. Prior to 8.1 the backenddid not reject this, but now it does.
1 parent9356877 commit56aa84a

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

‎doc/src/sgml/lobj.sgml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.37 2005/06/13 02:26:46 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.38 2006/03/02 21:49:09 tgl Exp $
33
-->
44

55
<chapter id="largeObjects">
@@ -527,7 +527,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len)
527527
int nwritten;
528528
int i;
529529

530-
lobj_fd = lo_open(conn, lobjId,INV_READ);
530+
lobj_fd = lo_open(conn, lobjId,INV_WRITE);
531531
if (lobj_fd &lt; 0)
532532
{
533533
fprintf(stderr, &quot;can't open large object %d\n&quot;,
@@ -553,7 +553,8 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len)
553553
}
554554

555555
/*
556-
* exportFile * export large object &quot;lobjOid&quot; to file &quot;out_filename&quot;
556+
* exportFile
557+
* export large object &quot;lobjOid&quot; to file &quot;out_filename&quot;
557558
*
558559
*/
559560
void
@@ -566,7 +567,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename)
566567
int fd;
567568

568569
/*
569-
*create an inversion &quot;object&quot;
570+
*open the largeobject
570571
*/
571572
lobj_fd = lo_open(conn, lobjId, INV_READ);
572573
if (lobj_fd &lt; 0)
@@ -586,7 +587,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename)
586587
}
587588

588589
/*
589-
* read in from theUnix file and write to theinversion file
590+
* read in from theinversion file and write to theUnix file
590591
*/
591592
while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) &gt; 0)
592593
{

‎src/test/examples/testlo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.25 2004/12/31 22:03:58 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.26 2006/03/02 21:49:09 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -113,7 +113,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len)
113113
intnwritten;
114114
inti;
115115

116-
lobj_fd=lo_open(conn,lobjId,INV_READ);
116+
lobj_fd=lo_open(conn,lobjId,INV_WRITE);
117117
if (lobj_fd<0)
118118
fprintf(stderr,"can't open large object %u",lobjId);
119119

@@ -156,7 +156,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename)
156156
intfd;
157157

158158
/*
159-
*create an inversion "object"
159+
*open the largeobject
160160
*/
161161
lobj_fd=lo_open(conn,lobjId,INV_READ);
162162
if (lobj_fd<0)
@@ -173,7 +173,7 @@ exportFile(PGconn *conn, Oid lobjId, char *filename)
173173
}
174174

175175
/*
176-
* read in from theUnix file and write to theinversion file
176+
* read in from theinversion file and write to theUnix file
177177
*/
178178
while ((nbytes=lo_read(conn,lobj_fd,buf,BUFSIZE))>0)
179179
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp