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:
the OID associated with the object
the pgobject
associated
with the object
the last warning/error message of the connection
Important: In multithreaded environments, error may be modified by another thread using the same
pgobject
. Remember that these object are shared, not duplicated; you should provide some locking if you want to check for the error message in this situation. The OID attribute is very interesting because it allow you to reuse the OID later, creating thepglarge
object with apgobject
getlo()
method call.
See also Chapter 2 for more information about the PostgreSQL large object interface.