Large Object: pglarge

PostgreSQL 7.2 Documentation
Prev | Chapter 9. PyGreSQL - Python Interface | Next

# 9.6. Large Object: `pglarge`

This object handles all the request concerning a PostgreSQL large object. It embeds and hides all the "recurrent" variables (object oid and connection), exactly in the same way `pgobject`s do, thus only keeping significant parameters in function calls. It keeps a reference to the `pgobject` used for its creation, sending requests though with its parameters. Any modification but dereferencing the `pgobject` will thus affect the `pglarge` object. Dereferencing the initial `pgobject` is not a problem since Python will not deallocate it before the large object dereference it. All functions return a generic error message on call error, whatever the exact error was. The `error` attribute of the object allows to get the exact error message.

`pglarge` objects define a read-only set of attributes that allow to get some information about it. These attributes are:

oid

  the oid associated with the object

pgcnx

  the `pgobject` associated with the object

error

  the last warning/error message of the connection

> Be careful: In multithreaded environments, `error` may be modified by another thread using the same `pgobject`. Remember these object are shared, not duplicated; you should provide some locking to be able if you want to check this. The oid attribute is very interesting because it allow you reuse the oid later, creating the `pglarge` object with a `pgobject` `getlo()` method call.

See also Chapter 2 for more information about the PostgreSQL large object interface.

Prev | Home | Next
ntuples | Up | open