Database Reference
In-Depth Information
lo_create
The syntax for the lo_create function is as follows:
Oid lo_create (PGconn *conn, int mode);
The lo_create function creates a new large object and returns an OID that is
assigned to the newly created large object.
This is how we will use this in our code example (see details of the symbolic
constants, that is, INV_READ , INV_WRITE , or INV_READ | INV_WRITE in the libpq/
libpq-fs.h header ile.):
lo_oid = lo_create (conn, INV_READ | INV_WRITE);
lo_import
We have already seen that lo_import is used to import a large object inside
the database.
The syntax for the lo_import function is as follows:
Oid lo_import (PGconn *conn, const char *filename);
This function takes a ilename as an argument that contains the full path of the object
and returns an OID. As the ile is read by the client interface library and not the
server, so it must exist in the client ile system with appropriate permissions.
The following example shows how lo_import is used:
lo_oid = lo_import (conn, FILE_NAME);
lo_export
The lo_export function is used to retrieve or export a large object from the system
table into the operating system ile.
The syntax for the lo_export function is as follows:
int lo_export (PGconn *conn, Oid lobjId, const char *filename);
The following example shows how lo_export is used:
lo_export (conn, lo_oid, FILE_NAME)
 
Search WWH ::




Custom Search