Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

postgresql.largeobject
Class LargeObjectManager  view LargeObjectManager download LargeObjectManager.java

java.lang.Object
  extended bypostgresql.largeobject.LargeObjectManager

public class LargeObjectManager
extends java.lang.Object

This class implements the large object interface to postgresql.

It provides methods that allow client code to create, open and delete large objects from the database. When opening an object, an instance of postgresql.largeobject.LargeObject is returned, and its methods then allow access to the object.

This class can only be created by postgresql.Connection

To get access to this class, use the following segment of code:

 import postgresql.largeobject.*;

 Connection  conn;
 LargeObjectManager lobj;

 ... code that opens a connection ...

 lobj = ((postgresql.Connection)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 postgresql.largeobject.LargeObject on how to manipulate the contents of a Large Object.


Field Summary
private  postgresql.fastpath.Fastpath fp
           
static int READ
          This mode indicates we want to read an object
static int READWRITE
          This mode is the default.
static int WRITE
          This mode indicates we want to write to an object
 
Constructor Summary
private LargeObjectManager()
          This prevents us being created by mere mortals
  LargeObjectManager(postgresql.Connection conn)
          Constructs the LargeObject API.
 
Method Summary
 int create()
          This creates a large object, returning its OID.
 int create(int mode)
          This creates a large object, returning its OID
 void delete(int oid)
          This deletes a large object.
 LargeObject open(int oid)
          This opens an existing large object, based on its OID.
 LargeObject open(int oid, int mode)
          This opens an existing large object, based on its OID
 void unlink(int oid)
          This deletes a large object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fp

private postgresql.fastpath.Fastpath fp

WRITE

public static final int WRITE
This mode indicates we want to write to an object

See Also:
Constant Field Values

READ

public static final int READ
This mode indicates we want to read an object

See Also:
Constant Field Values

READWRITE

public static final int READWRITE
This mode is the default. It indicates we want read and write access to a large object

See Also:
Constant Field Values
Constructor Detail

LargeObjectManager

private LargeObjectManager()
This prevents us being created by mere mortals


LargeObjectManager

public LargeObjectManager(postgresql.Connection conn)
                   throws java.sql.SQLException
Constructs the LargeObject API.

Important Notice
This method should only be called by postgresql.Connection

There should only be one LargeObjectManager per Connection. The postgresql.Connection class keeps track of the various extension API's and it's advised you use those to gain access, and not going direct.

Method Detail

open

public LargeObject open(int oid)
                 throws java.sql.SQLException
This opens an existing large object, based on its OID. This method assumes that READ and WRITE access is required (the default).


open

public LargeObject open(int oid,
                        int mode)
                 throws java.sql.SQLException
This opens an existing large object, based on its OID


create

public int create()
           throws java.sql.SQLException
This creates a large object, returning its OID.

It defaults to READWRITE for the new object's attributes.


create

public int create(int mode)
           throws java.sql.SQLException
This creates a large object, returning its OID


delete

public void delete(int oid)
            throws java.sql.SQLException
This deletes a large object.


unlink

public void unlink(int oid)
            throws java.sql.SQLException
This deletes a large object.

It is identical to the delete method, and is supplied as the C API uses unlink.