com.informix.jdbc
Class IfxSmartBlob

java.lang.Object
  extended bycom.informix.jdbc.IfxSmartBlob

public class IfxSmartBlob
extends java.lang.Object

The IfxSmartBlob class provides smart large object access. This class provides open, close, read, write, and other Informix smart blob access methods.


Field Summary
static int LO_APPEND
          Indicates if the open or create mode of the smart large object is append mode.
static int LO_BUFFER
          Indicates if the open or create mode of the smart large object is buffer.
static int LO_CLIENT_FILE
          to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE
static int LO_CURRENT_END
          to be used with IfxLoLock/IfxLoUnlock
static int LO_DIRTY_READ
          Indicates if the open or create mode of the smart large object is dirty read.
static int LO_EXCLUSIVE_MODE
          to be used with IfxLoLock/IfxLoUnlock
static int LO_FORWARD
          Indicates if the open or create mode of the smart large object is forward.
static int LO_LOCKALL
          Indicates if the open or create mode of the smart large object is lock all.
static int LO_LOCKRANGE
          Indicates if the open or create mode of the smart large object is lock range.
static int LO_MAX_END
          to be used with IfxLoLock/IfxLoUnlock
static int LO_NOBUFFER
          Indicates if the open or create mode of the smart large object is no buffer.
static int LO_NODIRTY_READ
          Indicates if the open or create mode of the smart large object is no dirty read.
static int LO_RANDOM
          Indicates if the open or create mode of the smart large object is random.
static int LO_RDONLY
          Indicates if the open or create mode of the smart large object is read only.
static int LO_RDWR
          Indicates if the open or create mode of the smart large object is read/write.
static int LO_REVERSE
          Indicates if the open or create mode of the smart large object is reverse.
static int LO_SEEK_CUR
          Indicates that seeking starts from the current position plus the set position.
static int LO_SEEK_END
          Indicates that seeking starts from the end of file plus the set position.
static int LO_SEEK_SET
          Indicates that seeking starts from the set position.
static int LO_SEQUENTIAL
          Indicates if the open or create mode of the smart large object is sequential.
static int LO_SERVER_FILE
          to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE
static int LO_SHARED_MODE
          to be used with IfxLoLock/IfxLoUnlock
static int LO_WRONLY
          Indicates if the open or create mode of the large object is write only.
 
Constructor Summary
IfxSmartBlob(java.sql.Connection conn)
           Creates an IfxSmartBlob object.
 
Method Summary
 int IfxLoAlter(IfxBblob blob, IfxLobDescriptor lodesc)
           IfxLoAlter() alters this blob using the new large object IfxLobDescriptor.
 int IfxLoAlter(IfxCblob clob, IfxLobDescriptor lodesc)
           IfxLoAlter() alters this clob using the new large object IfxLobDescriptor.
 int IfxLoAlter(IfxLocator locator, IfxLobDescriptor lodesc)
           IfxLoAlter() alter the smartblob from this locator using the new IfxLobDescriptor lodesc.
 void IfxLoClose(int lofd)
           Closes the smart large object referenced by the given locator.
 IfxLobDescriptor IfxLoColInfo(java.lang.String name)
           Gets the smart large object characteristics for the specified column.
 int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxBblob blob)
           Creates a new smart large object and opens it on the server.
 int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxCblob clob)
           Creates a new large object and opens it on the server.
 int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxLocator locator)
           Creates a new smart large object and opens it on the server.
 int IfxLoFromFile(int lofd, java.lang.String name, int flag, int offset, int amount)
           IfxLoFromFile() copies a smart large object from a file on server or client into a smart large object file descriptor.
 IfxLoStat IfxLoGetStat(int lofd)
           Returns an IfxLoStat object, which provides statistical information, such as the last access time, the last update status time, the last modification time, and the reference count of the smart large object.
 int IfxLoLock(int lofd, long offset, int whence, long range, int lockmode)
           IfxLoLock() lock a range of bytes in the given large object file descriptor in a requested mode.
 int IfxLoOpen(IfxBblob blob, int mode)
           Opens the smart large object that is referenced by the specified IfxBblob object.
 int IfxLoOpen(IfxCblob clob, int mode)
           Opens the smart large object that is referenced by the specified IfxCblob object.
 int IfxLoOpen(IfxLocator locator, int mode)
           Opens the smart large object that is referenced by the specified locator.
 int IfxLoRead(int lofd, byte[] buffer, int nbytes)
           Reads nbytes of data from the smart large object into the give byte array.
 int IfxLoRead(int lofd, byte[] buffer, int nbytes, int off)
           Reads nbytes of data from the smart large object into the give byte array.
 int IfxLoRead(int lofd, java.io.FileOutputStream fout, int nbytes)
           Reads nbytes of data from the smart large object into the file stream.
 byte[] IfxLoRead(int lofd, int nbytes)
           Reads nbytes of data from the smart large object.
 void IfxLoRelease()
           Releases the smart large object resources associated with the locator.
 void IfxLoRelease(IfxBblob blob)
           Releases the smart large object resources assoicated with the smart blob object.
 void IfxLoRelease(IfxCblob clob)
           Releases the smart large object resources assoicated with the smart clob object.
 void IfxLoRelease(IfxLocator locator)
           Releases the smart large object resources associated with the locator.
 long IfxLoSeek(int lofd, long offset, int whence)
           Sets the position for the next read and write operation of the smart large object referenced by the given locator.
 long IfxLoSize(int lofd)
           Returns the size of the smart large object.
 long IfxLoTell(int lofd)
           Returns the current seek position, which is the offset for the next read or write operation on the smart large object.
 int IfxLoToFile(IfxBblob blob, java.lang.String name, int flag)
           IfxLoToFile() copies a large object blob to a file on the client or server.
 int IfxLoToFile(IfxCblob clob, java.lang.String name, int flag)
           IfxLoToFile() copies a large object clob to a file on the client or server.
 int IfxLoToFile(IfxLocator locator, java.lang.String name, int flag)
           IfxLoToFile() copies the source locator of a large object to a file on the client or server.
 void IfxLoTruncate(int lofd, long size)
           Truncates the smart large object to the specific size.
 int IfxLoUnLock(int lofd, long offset, int whence, long range)
           IfxLoUnLock() unlock a range of bytes in the given large object file descriptor.
 int IfxLoWrite(int lofd, byte[] buffer)
           Writes the given data into the smart large object.
 int IfxLoWrite(int lofd, byte[] buffer, int offset, int length)
           
 int IfxLoWrite(int lofd, java.io.InputStream fin, int length)
           Writes the given data into the smart large object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LO_APPEND

public static final int LO_APPEND
Indicates if the open or create mode of the smart large object is append mode.

See Also:
Constant Field Values

LO_WRONLY

public static final int LO_WRONLY
Indicates if the open or create mode of the large object is write only.

See Also:
Constant Field Values

LO_RDONLY

public static final int LO_RDONLY
Indicates if the open or create mode of the smart large object is read only.

See Also:
Constant Field Values

LO_RDWR

public static final int LO_RDWR
Indicates if the open or create mode of the smart large object is read/write.

See Also:
Constant Field Values

LO_DIRTY_READ

public static final int LO_DIRTY_READ
Indicates if the open or create mode of the smart large object is dirty read.

See Also:
Constant Field Values

LO_RANDOM

public static final int LO_RANDOM
Indicates if the open or create mode of the smart large object is random.

See Also:
Constant Field Values

LO_SEQUENTIAL

public static final int LO_SEQUENTIAL
Indicates if the open or create mode of the smart large object is sequential.

See Also:
Constant Field Values

LO_FORWARD

public static final int LO_FORWARD
Indicates if the open or create mode of the smart large object is forward.

See Also:
Constant Field Values

LO_REVERSE

public static final int LO_REVERSE
Indicates if the open or create mode of the smart large object is reverse.

See Also:
Constant Field Values

LO_BUFFER

public static final int LO_BUFFER
Indicates if the open or create mode of the smart large object is buffer.

See Also:
Constant Field Values

LO_NOBUFFER

public static final int LO_NOBUFFER
Indicates if the open or create mode of the smart large object is no buffer.

See Also:
Constant Field Values

LO_NODIRTY_READ

public static final int LO_NODIRTY_READ
Indicates if the open or create mode of the smart large object is no dirty read.

See Also:
Constant Field Values

LO_LOCKALL

public static final int LO_LOCKALL
Indicates if the open or create mode of the smart large object is lock all.

See Also:
Constant Field Values

LO_LOCKRANGE

public static final int LO_LOCKRANGE
Indicates if the open or create mode of the smart large object is lock range.

See Also:
Constant Field Values

LO_SEEK_SET

public static final int LO_SEEK_SET
Indicates that seeking starts from the set position.

See Also:
Constant Field Values

LO_SEEK_CUR

public static final int LO_SEEK_CUR
Indicates that seeking starts from the current position plus the set position.

See Also:
Constant Field Values

LO_SEEK_END

public static final int LO_SEEK_END
Indicates that seeking starts from the end of file plus the set position.

See Also:
Constant Field Values

LO_CLIENT_FILE

public static final int LO_CLIENT_FILE
to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE

See Also:
Constant Field Values

LO_SERVER_FILE

public static final int LO_SERVER_FILE
to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE

See Also:
Constant Field Values

LO_SHARED_MODE

public static final int LO_SHARED_MODE
to be used with IfxLoLock/IfxLoUnlock

See Also:
Constant Field Values

LO_EXCLUSIVE_MODE

public static final int LO_EXCLUSIVE_MODE
to be used with IfxLoLock/IfxLoUnlock

See Also:
Constant Field Values

LO_MAX_END

public static final int LO_MAX_END
to be used with IfxLoLock/IfxLoUnlock

See Also:
Constant Field Values

LO_CURRENT_END

public static final int LO_CURRENT_END
to be used with IfxLoLock/IfxLoUnlock

See Also:
Constant Field Values
Constructor Detail

IfxSmartBlob

public IfxSmartBlob(java.sql.Connection conn)
             throws java.sql.SQLException

Creates an IfxSmartBlob object.

Parameters:
conn - the java.sql.Connection object for this Informix database
Throws:
java.sql.SQLException - if there is an error accessing database
Method Detail

IfxLoColInfo

public IfxLobDescriptor IfxLoColInfo(java.lang.String name)
                              throws java.sql.SQLException

Gets the smart large object characteristics for the specified column.

Parameters:
name - the name of the column
Returns:
The smart large object name descriptor.
Throws:
java.sql.SQLException - if there is an error accessing database
See Also:
IfxLobDescriptor

IfxLoCreate

public int IfxLoCreate(IfxLobDescriptor lodesc,
                       int mode,
                       IfxLocator locator)
                throws java.sql.SQLException

Creates a new smart large object and opens it on the server.

Parameters:
lodesc - - the large object descriptor for the smart large object
mode - - the access mode for creating the large object
locator - - reference to where the smart large object is stored It is populated upon successful creation of the smart large object.
Returns:
large object file descriptor
Throws:
java.sql.SQLException - if there is an error accessing database
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR, IfxLobDescriptor, IfxLocator

IfxLoCreate

public int IfxLoCreate(IfxLobDescriptor lodesc,
                       int mode,
                       IfxBblob blob)
                throws java.sql.SQLException

Creates a new smart large object and opens it on the server.

Parameters:
lodesc - - the large object descriptor for the smart large object
mode - - the access mode for creating the large object
blob - - This is populated upon successful creation of the smart large object.
Returns:
the large object file handle.
Throws:
java.sql.SQLException - if there is an error accessing database
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR, IfxLobDescriptor, IfxBblob

IfxLoCreate

public int IfxLoCreate(IfxLobDescriptor lodesc,
                       int mode,
                       IfxCblob clob)
                throws java.sql.SQLException

Creates a new large object and opens it on the server.

Parameters:
lodesc - - the large object descriptor
mode - - the access mode for creating the large object
clob - - This is populated upon successful creation of the smart large object.
Returns:
the large object file descriptor
Throws:
java.sql.SQLException - if there is an error accessing database
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR, IfxLobDescriptor, IfxCblob

IfxLoOpen

public int IfxLoOpen(IfxLocator locator,
                     int mode)
              throws java.sql.SQLException

Opens the smart large object that is referenced by the specified locator.

Parameters:
locator - - the locator that identifies the smart blob object to be opened
mode - - the access mode for opening the smart large object
Returns:
the large object file descriptor
Throws:
java.sql.SQLException - if there is an error accessing smart large object
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR

IfxLoOpen

public int IfxLoOpen(IfxBblob blob,
                     int mode)
              throws java.sql.SQLException

Opens the smart large object that is referenced by the specified IfxBblob object.

Parameters:
blob - the IfxBblob that identifies the smart blob object to be opened
mode - the access mode for opening the smart large object
Returns:
the locator handle that references the smart large object
Throws:
java.sql.SQLException - if there is an error accessing smart large object
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR

IfxLoOpen

public int IfxLoOpen(IfxCblob clob,
                     int mode)
              throws java.sql.SQLException

Opens the smart large object that is referenced by the specified IfxCblob object.

Parameters:
clob - The IfxCblob that identifies the smart clob object to be opened
mode - The access mode for opening the smart large object
Returns:
The locator handle that references the smart large object
Throws:
java.sql.SQLException - if there is an error accessing smart large object
See Also:
LO_APPEND, LO_RDONLY, LO_WRONLY, LO_RDWR

IfxLoRelease

public void IfxLoRelease()
                  throws java.sql.SQLException

Releases the smart large object resources associated with the locator.

Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRelease

public void IfxLoRelease(IfxLocator locator)
                  throws java.sql.SQLException

Releases the smart large object resources associated with the locator.

Parameters:
locator - the locator that references the smart large object
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRelease

public void IfxLoRelease(IfxBblob blob)
                  throws java.sql.SQLException

Releases the smart large object resources assoicated with the smart blob object.

Parameters:
blob - the IfxBblob that identifies the smart blob object whose locator has to be released
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRelease

public void IfxLoRelease(IfxCblob clob)
                  throws java.sql.SQLException

Releases the smart large object resources assoicated with the smart clob object.

Parameters:
clob - the IfxCblob that identifies the smart clob object whose locator has to be released
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoClose

public void IfxLoClose(int lofd)
                throws java.sql.SQLException

Closes the smart large object referenced by the given locator.

Parameters:
lofd - the locator handle that references the smart large object
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoSeek

public long IfxLoSeek(int lofd,
                      long offset,
                      int whence)
               throws java.sql.SQLException

Sets the position for the next read and write operation of the smart large object referenced by the given locator.

Parameters:
lofd - the locator handle that references this smart large object
offset - the offset from the location specified in the whence parameter
whence - LO_SEEK_SET, from begining; LO_SEEK_CUR, relative from current position; LO_SEEK_END, from the end.
Returns:
The absolute position from the begining of the smart large object.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoTruncate

public void IfxLoTruncate(int lofd,
                          long size)
                   throws java.sql.SQLException

Truncates the smart large object to the specific size.

Parameters:
lofd - the handle that references the smart large object
size - the size to which the smart large object is truncated
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoSize

public long IfxLoSize(int lofd)
               throws java.sql.SQLException

Returns the size of the smart large object.

Parameters:
lofd - the handle that references the smart large object
Returns:
The size of the smart large object.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoGetStat

public IfxLoStat IfxLoGetStat(int lofd)
                       throws java.sql.SQLException

Returns an IfxLoStat object, which provides statistical information, such as the last access time, the last update status time, the last modification time, and the reference count of the smart large object.

Parameters:
lofd - The handle that references the smart large object
Returns:
The IfxLoStat object that contains statistical information
Throws:
java.sql.SQLException - if there is an error accessing smart large object
See Also:
IfxLoStat

IfxLoTell

public long IfxLoTell(int lofd)
               throws java.sql.SQLException

Returns the current seek position, which is the offset for the next read or write operation on the smart large object.

Parameters:
lofd - the locator handle that references the smart large object
Returns:
The current offset.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRead

public byte[] IfxLoRead(int lofd,
                        int nbytes)
                 throws java.sql.SQLException

Reads nbytes of data from the smart large object.

Parameters:
lofd - the locator handle that references the smart large object
nbytes - the number of bytes to be read
Returns:
The smart large object data.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRead

public int IfxLoRead(int lofd,
                     byte[] buffer,
                     int nbytes)
              throws java.sql.SQLException

Reads nbytes of data from the smart large object into the give byte array.

Parameters:
lofd - the locator handle that references the smart large object
buffer - the buffer into which the data is read
nbytes - the number of bytes of data to be read
Returns:
The number of bytes read.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRead

public int IfxLoRead(int lofd,
                     java.io.FileOutputStream fout,
                     int nbytes)
              throws java.sql.SQLException

Reads nbytes of data from the smart large object into the file stream.

Parameters:
lofd - the locator handle that references the smart large object
fout - the file stream into which the data is read
nbytes - the number of bytes to be read
Returns:
The number of bytes read.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoRead

public int IfxLoRead(int lofd,
                     byte[] buffer,
                     int nbytes,
                     int off)
              throws java.sql.SQLException

Reads nbytes of data from the smart large object into the give byte array.

Parameters:
lofd - the handle that references the smart large object
buffer - the buffer into which the data is read
nbytes - the number of bytes of data to be read
off - the start offset of the data
Returns:
The number of bytes read.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoWrite

public int IfxLoWrite(int lofd,
                      byte[] buffer)
               throws java.sql.SQLException

Writes the given data into the smart large object.

Parameters:
lofd - the locator handle that references the smart large object
buffer - the data to write to the smart large object
Returns:
The number of bytes written.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoWrite

public int IfxLoWrite(int lofd,
                      byte[] buffer,
                      int offset,
                      int length)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

IfxLoWrite

public int IfxLoWrite(int lofd,
                      java.io.InputStream fin,
                      int length)
               throws java.sql.SQLException

Writes the given data into the smart large object.

Parameters:
lofd - the locator handle that references the smart large object
fin - the file stream from which the data is written
length - the number of bytes to be written
Returns:
The number of bytes written.
Throws:
java.sql.SQLException - if there is an error accessing smart large object

IfxLoLock

public int IfxLoLock(int lofd,
                     long offset,
                     int whence,
                     long range,
                     int lockmode)
              throws java.sql.SQLException

IfxLoLock() lock a range of bytes in the given large object file descriptor in a requested mode.

Parameters:
lofd - - given open large object file descriptor.
offset - - offset indicated by whence.
whence - - indicating starting point
range - - size of range
lockmode - - LO_SHARED_MODE or LO_EXCLUSIVE_MODE
Returns:
0:Success, -1:Failure
Throws:
java.sql.SQLException

IfxLoUnLock

public int IfxLoUnLock(int lofd,
                       long offset,
                       int whence,
                       long range)
                throws java.sql.SQLException

IfxLoUnLock() unlock a range of bytes in the given large object file descriptor.

Parameters:
lofd - - given large object file descriptor.
offset - - offset indicated by whence.
whence - - indicating starting point
range - - size of range
Returns:
0:Success, -1:Failure
Throws:
java.sql.SQLException

IfxLoAlter

public int IfxLoAlter(IfxLocator locator,
                      IfxLobDescriptor lodesc)
               throws java.sql.SQLException

IfxLoAlter() alter the smartblob from this locator using the new IfxLobDescriptor lodesc.

Parameters:
locator - - the smartblob locator
lodesc - - the new specification.
Returns:
0: Success, -1 : Failure
Throws:
java.sql.SQLException

IfxLoAlter

public int IfxLoAlter(IfxBblob blob,
                      IfxLobDescriptor lodesc)
               throws java.sql.SQLException

IfxLoAlter() alters this blob using the new large object IfxLobDescriptor.

Parameters:
blob - - the smartblob
lodesc - - the new specification
Returns:
0:Success, -1:Failure
Throws:
java.sql.SQLException

IfxLoAlter

public int IfxLoAlter(IfxCblob clob,
                      IfxLobDescriptor lodesc)
               throws java.sql.SQLException

IfxLoAlter() alters this clob using the new large object IfxLobDescriptor.

Parameters:
clob - - the smartblob
lodesc - - the new specification
Returns:
0:Success, -1:Failure
Throws:
java.sql.SQLException

IfxLoFromFile

public int IfxLoFromFile(int lofd,
                         java.lang.String name,
                         int flag,
                         int offset,
                         int amount)
                  throws java.sql.SQLException

IfxLoFromFile() copies a smart large object from a file on server or client into a smart large object file descriptor.

Parameters:
lofd - - an open file descriptor for the target smart large object.
name - - name of the source file on server or client.
flag - - LO_SERVER_FILE or LO_CLIENT_FILE
offset - - offset into smartblob starting position
amount - - amount to copy
Returns:
Success/Failure status. 0 for Success.
Throws:
java.sql.SQLException

IfxLoToFile

public int IfxLoToFile(IfxLocator locator,
                       java.lang.String name,
                       int flag)
                throws java.sql.SQLException

IfxLoToFile() copies the source locator of a large object to a file on the client or server.

Parameters:
locator - - source locator of large object to be copied
name - - destination of file name of the large object.
flag - - LO_SERVER_FILE or LO_CLIENT_FILE
Returns:
number of bytes copied.
Throws:
java.sql.SQLException

IfxLoToFile

public int IfxLoToFile(IfxBblob blob,
                       java.lang.String name,
                       int flag)
                throws java.sql.SQLException

IfxLoToFile() copies a large object blob to a file on the client or server.

Parameters:
blob - - source large object to be copied
name - - destination of file name of the large object.
flag - - LO_SERVER_FILE or LO_CLIENT_FILE
Returns:
number of bytes copied.
Throws:
java.sql.SQLException

IfxLoToFile

public int IfxLoToFile(IfxCblob clob,
                       java.lang.String name,
                       int flag)
                throws java.sql.SQLException

IfxLoToFile() copies a large object clob to a file on the client or server.

Parameters:
clob - - source large object to be copied
name - - destination of file name of the large object.
flag - - LO_SERVER_FILE or LO_CLIENT_FILE
Returns:
number of bytes copied.
Throws:
java.sql.SQLException