Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.driver.Clob Class Reference

List of all members.

Public Member Functions

 Clob (String data)
long length () throws SQLException
java.io.InputStream getAsciiStream () throws SQLException
java.io.Reader getCharacterStream () throws SQLException
String getSubString (long pos, int length) throws SQLException
long position (String searchstr, long start) throws SQLException
long position (java.sql.Clob searchstr, long start) throws SQLException
OutputStream setAsciiStream (long pos) throws SQLException
Writer setCharacterStream (long pos) throws SQLException
int setString (long pos, String str) throws SQLException
int setString (long pos, String str, int offset, int len) throws SQLException
void truncate (long len) throws SQLException

Detailed Description

The representation (mapping) in the Java TM programming language of an SQL CLOB value. An SQL CLOB is a built-in type that stores a Character Large Object as a column value in a row of a database table. By default drivers implement Clob using an SQL locator(CLOB), which means that a Clob object contains a logical pointer to the SQL CLOB data rather than the data itself. A Clob object is valid for the duration of the transaction in which is was created.

Methods in the interfaces DriverResultSet,CallableStatement, and PreparedStatement, such as getClob and setClob allow a programmer to access an SQL CLOB value. The Clob interface provides methods for getting the length of an SQL CLOB (Character Large Object) value, for materializing a CLOB value on the client, and for determining the position of a pattern of bytes within a CLOB value. In addition, this interface has methods for updating a CLOB value.

Author:
Nicolas Modrzyk
Since:
JDK 1.2

Definition at line 59 of file Clob.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.driver.Clob.Clob String  data  ) 
 

Creates a new Clob instance.

Parameters:
data a String of character data

Definition at line 69 of file Clob.java.

00070   {
00071     stringData = data;
00072   }


Member Function Documentation

java.io.InputStream org.objectweb.cjdbc.driver.Clob.getAsciiStream  )  throws SQLException
 

Retrieves the CLOB value designated by this Clob instance as a stream.

Returns:
a stream containing the CLOB data
Exceptions:
SQLException if there is an error accessing the CLOB value
Since:
JDK 1.2

Definition at line 98 of file Clob.java.

00099   {
00100     return new ByteArrayInputStream(stringData.getBytes());
00101   }

java.io.Reader org.objectweb.cjdbc.driver.Clob.getCharacterStream  )  throws SQLException
 

Materializes the CLOB value designated by this object as a stream of Unicode character.

Returns:
A reader object with all the data in the CLOB value designated by this clob object as unicode characters.
Exceptions:
SQLException if there is an error accessing the CLOB value

Definition at line 112 of file Clob.java.

00113   {
00114     return new StringReader(stringData);
00115   }

String org.objectweb.cjdbc.driver.Clob.getSubString long  pos,
int  length
throws SQLException
 

Returns a copy of the portion of the CLOB value represented by this CLOB object that starts at position position and has ip to length consecutive characters.

Parameters:
pos the position where to get the substring from
length the length of the substring
Returns:
the substring
Exceptions:
SQLException if there is an error accessing the CLOB
Since:
JDK 1.2

Definition at line 129 of file Clob.java.

References org.objectweb.cjdbc.driver.Clob.length().

00130   {
00131     if (length > stringData.length())
00132       throw new SQLException("Clob contains only " + stringData.length()
00133           + " characters (asking for " + length + ").");
00134     return stringData.substring((int) pos, length);
00135   }

long org.objectweb.cjdbc.driver.Clob.length  )  throws SQLException
 

Returns the size of the CLOB value designated by this Clob object

Returns:
length of the CLOB value that this clob represents
Exceptions:
SQLException if there is an error accessing the length of the CLOB
Since:
JDK 1.2

Definition at line 84 of file Clob.java.

Referenced by org.objectweb.cjdbc.driver.Clob.getSubString().

00085   {
00086     return stringData.length();
00087   }

long org.objectweb.cjdbc.driver.Clob.position java.sql.Clob  searchstr,
long  start
throws SQLException
 

Retrieves the character position at which the specified Clob object searchstr begins within the CLOB value that this Clob object represents. The search for searchstr begins at position start.

Parameters:
searchstr the byte array for which to search
start the position at which to begin searching; the first position is 1
Returns:
the position at which the pattern appears, else -1
Exceptions:
SQLException if there is an error accessing the CLOB
Since:
JDK 1.2

Definition at line 170 of file Clob.java.

References org.objectweb.cjdbc.driver.Clob.position().

00171   {
00172     return position(searchstr.getSubString(0, (int) searchstr.length()),
00173         (int) start);
00174   }

long org.objectweb.cjdbc.driver.Clob.position String  searchstr,
long  start
throws SQLException
 

Retrieves the character position at which the specified string searchstr begins within the CLOB value that this Clob object represents. The search for searchstr begins at position start.

Parameters:
searchstr the byte array for which to search
start the position at which to begin searching; the first position is 1
Returns:
the position at which the pattern appears, else -1
Exceptions:
SQLException if there is an error accessing the CLOB
Since:
JDK 1.2

Definition at line 151 of file Clob.java.

Referenced by org.objectweb.cjdbc.driver.Clob.position().

00152   {
00153     return stringData.indexOf(searchstr, (int) start);
00154   }

OutputStream org.objectweb.cjdbc.driver.Clob.setAsciiStream long  pos  )  throws SQLException
 

Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos.

Parameters:
pos the position where to start the stream
Returns:
the ascii outputstream to this clob object
Exceptions:
SQLException if there is an error accessing the clob

Definition at line 186 of file Clob.java.

00187   {
00188     throw new NotImplementedException("setAsciiStream");
00189   }

Writer org.objectweb.cjdbc.driver.Clob.setCharacterStream long  pos  )  throws SQLException
 

Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, at position pos.

Parameters:
pos the position where to start the writer
Returns:
the writer to this clob object
Exceptions:
SQLException if there is an error accessing the clob

Definition at line 199 of file Clob.java.

00200   {
00201     throw new NotImplementedException("setCharacterStream");
00202   }

int org.objectweb.cjdbc.driver.Clob.setString long  pos,
String  str,
int  offset,
int  len
throws SQLException
 

Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

Parameters:
pos the position
str the string
offset the offset
len the length
Returns:
return value
Exceptions:
SQLException if there is an error accessing the clob

Definition at line 229 of file Clob.java.

00231   {
00232     throw new NotImplementedException("setString");
00233   }

int org.objectweb.cjdbc.driver.Clob.setString long  pos,
String  str
throws SQLException
 

Writes the given Java String to the CLOB value that this Clob object designates at the position pos.

Parameters:
pos the position where to set the string
str string to insert in the clob
Returns:
return value
Exceptions:
SQLException if there is an error accessing the clob

Definition at line 213 of file Clob.java.

00214   {
00215     throw new NotImplementedException("setString");
00216   }

void org.objectweb.cjdbc.driver.Clob.truncate long  len  )  throws SQLException
 

Truncates the CLOB value that this Clob designates to have a length of len characters.

Parameters:
len the length
Exceptions:
SQLException if there is an error accessing the clob

Definition at line 242 of file Clob.java.

00243   {
00244     throw new NotImplementedException("truncate");
00245   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:04:52 2005 for C-JDBC by  doxygen 1.3.9.1