@@ -147,13 +145,13 @@ Oid lo_import(PGconn *<replaceable class="parameter">conn</replaceable>, text *<
...
@@ -147,13 +145,13 @@ Oid lo_import(PGconn *<replaceable class="parameter">conn</replaceable>, text *<
<para>
<para>
To export a large object
To export a large object
into <acronym>Unix</acronym> file, call
into <acronym>UNIX</acronym> file, call
<synopsis>
<synopsis>
int lo_export(PGconn *<replaceable class="parameter">conn</replaceable>, Oid <replaceable class="parameter">lobjId</replaceable>, text *<replaceable class="parameter">filename</replaceable>)
int lo_export(PGconn *<replaceable class="parameter">conn</replaceable>, Oid <replaceable class="parameter">lobjId</replaceable>, const char *<replaceable class="parameter">filename</replaceable>)
</synopsis>
</synopsis>
The lobjId argument specifies the Oid of the large
The lobjId argument specifies the Oid of the large
object to export and the filename argument specifies
object to export and the filename argument specifies
the <acronym>Unix</acronym> pathname of the file.
the <acronym>UNIX</acronym> pathname of the file.
</para>
</para>
</sect2>
</sect2>
...
@@ -162,16 +160,18 @@ int lo_export(PGconn *<replaceable class="parameter">conn</replaceable>, Oid <re
...
@@ -162,16 +160,18 @@ int lo_export(PGconn *<replaceable class="parameter">conn</replaceable>, Oid <re
<para>
<para>
To open an existing large object, call
To open an existing large object, call
<programlisting>
<synopsis>
int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
int lo_open(PGconn *conn, Oid lobjId, int mode)
</programlisting>
</synopsis>
The lobjId argument specifies the Oid of the large
The lobjId argument specifies the Oid of the large
object to open. The mode bits control whether the
object to open. The mode bits control whether the
object is opened for reading INV_READ), writing or
object is opened for reading INV_READ), writing or
both.
both.
A large object cannot be opened before it is created.
A large object cannot be opened before it is created.
lo_open returns a large object descriptor for later use
<function>lo_open</function> returns a large object descriptor
in lo_read, lo_write, lo_lseek, lo_tell, and lo_close.
for later use in <function>lo_read</function>, <function>lo_write</function>,
<function>lo_lseek</function>, <function>lo_tell</function>, and
<function>lo_close</function>.
</para>
</para>
</sect2>
</sect2>
...
@@ -181,15 +181,30 @@ int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
...
@@ -181,15 +181,30 @@ int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
<para>
<para>
The routine
The routine
<programlisting>
<programlisting>
int lo_write(PGconn *conn, int fd, char *buf, int len)
int lo_write(PGconn *conn, int fd, const char *buf, size_t len)
</programlisting>
</programlisting>
writes len bytes from buf to large object fd. The fd
writes len bytes from buf to large object fd. The fd
argument must have been returned by a previous lo_open.
argument must have been returned by a previous <function>lo_open</function>.
The number of bytes actually written is returned. In
The number of bytes actually written is returned. In
the event of an error, the return value is negative.
the event of an error, the return value is negative.
</para>
</para>
</sect2>
</sect2>
<sect2>
<title>Reading Data from a Large Object</title>
<para>
The routine
<programlisting>
int lo_read(PGconn *conn, int fd, char *buf, size_t len)
</programlisting>
reads len bytes from large object fd into byf. The fd
argument must have been returned by a previous <function>lo_open</function>.
The number of bytes actually read is returned. In
the event of an error, the return value is negative.
</para>
</sect2>
<sect2>
<sect2>
<title>Seeking on a Large Object</title>
<title>Seeking on a Large Object</title>
...
@@ -201,8 +216,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence)
...
@@ -201,8 +216,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence)
</programlisting>
</programlisting>
This routine moves the current location pointer for the
This routine moves the current location pointer for the
large object described by fd to the new location specified
large object described by fd to the new location specified
by offset. The valid values for .i whence are
by offset. The valid values for whence are
SEEK_SET SEEK_CUR and SEEK_END.
SEEK_SET, SEEK_CUR, and SEEK_END.
</para>
</para>
</sect2>
</sect2>
...
@@ -215,8 +230,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence)
...
@@ -215,8 +230,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence)
int lo_close(PGconn *conn, int fd)
int lo_close(PGconn *conn, int fd)
</programlisting>
</programlisting>
where fd is a large object descriptor returned by
where fd is a large object descriptor returned by
lo_open. On success, <acronym>lo_close</acronym> returns zero. On error,
<function>lo_open</function>. On success, <function>lo_close</function>
the return value is negative.
returns zero. On error, the return value is negative.