It provides methods that allow client code to create, open and delete large objects from the database. When opening an object, an instance of org.postgresql.largeobject.LargeObject is returned, and its methods then allow access to the object.
This class can only be created by BaseConnection
To get access to this class, use the following segment of code:
import org.postgresql.largeobject.*; Connection conn; LargeObjectManager lobj; ... code that opens a connection ... lobj = ((org.postgresql.PGConnection)myconn).getLargeObjectAPI();
Normally, client code would use the getAsciiStream, getBinaryStream, or getUnicodeStream methods in ResultSet, or setAsciiStream, setBinaryStream, or setUnicodeStream methods in PreparedStatement to access Large Objects.
However, sometimes lower level access to Large Objects are required, that are not supported by the JDBC specification.
Refer to org.postgresql.largeobject.LargeObject on how to manipulate the contents of a Large Object.
java.sql.ResultSet#getAsciiStream , java.sql.ResultSet#getBinaryStream , java.sql.ResultSet#getUnicodeStream , java.sql.PreparedStatement#setAsciiStream , java.sql.PreparedStatement#setBinaryStream , java.sql.PreparedStatement#setUnicodeStream
| Modifier and Type | Field and Description |
|---|---|
| private BaseConnection | |
| private Fastpath | |
| public static final int | READ
This mode indicates we want to read an object. |
| public static final int | READWRITE
This mode is the default. |
| public static final int | WRITE
This mode indicates we want to write to an object. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: oid of new object
Deprecated
As of 8.3, replaced by
createLO()
This creates a large object, returning its OID. |
| public int | Returns: oid of new objecta bitmask describing different attributes of the new object mode)
Deprecated
As of 8.3, replaced by
createLO(int)
This creates a large object, returning its OID. |
| public long | |
| public long | Returns: oid of new objecta bitmask describing different attributes of the new object mode)This creates a large object, returning its OID. |
| public void | |
| public void | delete(int
describing object to delete oid)
Deprecated
As of 8.3, replaced by
delete(long)
This deletes a large object. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid)
Deprecated
As of 8.3, replaced by
open(long)
This opens an existing large object, based on its OID. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, boolean commit the transaction when this LOB will be closed commitOnClose)This opens an existing large object, same as previous method, but commits the transaction on close if asked. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid)This opens an existing large object, based on its OID. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, boolean commit the transaction when this LOB will be closed commitOnClose)This opens an existing large object, same as previous method, but commits the transaction on close if asked. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, int mode of open mode)
Deprecated
As of 8.3, replaced by
open(long, int)
This opens an existing large object, based on its OID. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, int mode of open mode, boolean commit the transaction when this LOB will be closed commitOnClose)This opens an existing large object, same as previous method, but commits the transaction on close if asked. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, int mode of open mode)This opens an existing large object, based on its OID. |
| public LargeObject | Returns: LargeObject instance providing access to the objectof large object oid, int mode of open mode, boolean commit the transaction when this LOB will be closed commitOnClose)This opens an existing large object, based on its OID. |
| public void | unlink(int
describing object to delete oid)
Deprecated
As of 8.3, replaced by
unlink(long)
This deletes a large object. |
| public void |
| conn | back to summary |
|---|---|
| private BaseConnection conn | |
| fp | back to summary |
|---|---|
| private Fastpath fp
References Deprecated
See corresponding docs for further information. | |
| READ | back to summary |
|---|---|
| public static final int READ This mode indicates we want to read an object. | |
| READWRITE | back to summary |
|---|---|
| public static final int READWRITE This mode is the default. It indicates we want read and write access to a large object. | |
| WRITE | back to summary |
|---|---|
| public static final int WRITE This mode indicates we want to write to an object. | |
| LargeObjectManager | back to summary |
|---|---|
| public LargeObjectManager(BaseConnection conn) throws SQLException Constructs the LargeObject API. Important Notice There should only be one LargeObjectManager per Connection. The
| |
| create | back to summary |
|---|---|
| public int create() throws SQLException
Deprecated As of 8.3, replaced by This creates a large object, returning its OID. It defaults to READWRITE for the new object's attributes.
| |
| create | back to summary |
|---|---|
| public int create(int mode) throws SQLException
Deprecated As of 8.3, replaced by This creates a large object, returning its OID.
| |
| createLO | back to summary |
|---|---|
| public long createLO() throws SQLException This creates a large object, returning its OID. It defaults to READWRITE for the new object's attributes.
| |
| createLO | back to summary |
|---|---|
| public long createLO(int mode) throws SQLException This creates a large object, returning its OID.
| |
| delete | back to summary |
|---|---|
| public void delete(long oid) throws SQLException This deletes a large object.
| |
| delete | back to summary |
|---|---|
| public void delete(int oid) throws SQLException
Deprecated As of 8.3, replaced by This deletes a large object.
| |
| open | back to summary |
|---|---|
| public LargeObject open(int oid) throws SQLException
Deprecated As of 8.3, replaced by This opens an existing large object, based on its OID. This method assumes that READ and WRITE access is required (the default).
| |
| open | back to summary |
|---|---|
| public LargeObject open(int oid, boolean commitOnClose) throws SQLException This opens an existing large object, same as previous method, but commits the transaction on close if asked. This is useful when the LOB is returned to a caller which won't take care of transactions by itself.
| |
| open | back to summary |
|---|---|
| public LargeObject open(long oid) throws SQLException This opens an existing large object, based on its OID. This method assumes that READ and WRITE access is required (the default).
| |
| open | back to summary |
|---|---|
| public LargeObject open(long oid, boolean commitOnClose) throws SQLException This opens an existing large object, same as previous method, but commits the transaction on close if asked.
| |
| open | back to summary |
|---|---|
| public LargeObject open(int oid, int mode) throws SQLException
Deprecated As of 8.3, replaced by This opens an existing large object, based on its OID.
| |
| open | back to summary |
|---|---|
| public LargeObject open(int oid, int mode, boolean commitOnClose) throws SQLException This opens an existing large object, same as previous method, but commits the transaction on close if asked.
| |
| open | back to summary |
|---|---|
| public LargeObject open(long oid, int mode) throws SQLException This opens an existing large object, based on its OID.
| |
| open | back to summary |
|---|---|
| public LargeObject open(long oid, int mode, boolean commitOnClose) throws SQLException This opens an existing large object, based on its OID.
| |
| unlink | back to summary |
|---|---|
| public void unlink(int oid) throws SQLException
Deprecated As of 8.3, replaced by This deletes a large object. It is identical to the delete method, and is supplied as the C API uses unlink.
| |
| unlink | back to summary |
|---|---|
| public void unlink(long oid) throws SQLException This deletes a large object. It is identical to the delete method, and is supplied as the C API uses unlink.
| |