Class ClobImpl
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.column.ClobImpl
-
- All Implemented Interfaces:
java.sql.Clob
public class ClobImpl extends java.lang.Object implements java.sql.Clob
The mapping in the Java programming language for the SQLCLOB
type. An SQLCLOB
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 aClob
object using an SQLlocator(CLOB)
, which means that aClob
object contains a logical pointer to the SQLCLOB
data rather than the data itself. AClob
object is valid for the duration of the transaction in which it was created.The
Clob
interface provides methods for getting the length of an SQLCLOB
(Character Large Object) value, for materializing aCLOB
value on the client, and for searching for a substring orCLOB
object within aCLOB
value. Methods in the interfacesResultSet
,CallableStatement
, andPreparedStatement
, such asgetClob
andsetClob
allow a programmer to access an SQLCLOB
value. In addition, this interface has methods for updating aCLOB
value.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
freed
Whether we have already freed resources.private java.io.InputStream
inputStream
InputStream for operations that work that way.private long
length
private java.io.StringReader
reader
Reader for the operations that work that way.private java.lang.String
string
-
Constructor Summary
Constructors Constructor Description ClobImpl(java.lang.String string)
Constructor taking a string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
free()
Free the Blob object and releases the resources that it holds.java.io.InputStream
getAsciiStream()
java.io.Reader
getCharacterStream()
java.io.Reader
getCharacterStream(long pos, long length)
Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.java.lang.String
getSubString(long pos, int length)
long
length()
long
position(java.lang.String searchstr, long start)
long
position(java.sql.Clob searchstr, long start)
java.io.OutputStream
setAsciiStream(long pos)
java.io.Writer
setCharacterStream(long pos)
int
setString(long pos, java.lang.String str)
int
setString(long pos, java.lang.String str, int offset, int len)
void
truncate(long len)
-
-
-
Field Detail
-
string
private java.lang.String string
-
length
private long length
-
reader
private java.io.StringReader reader
Reader for the operations that work that way.
-
inputStream
private java.io.InputStream inputStream
InputStream for operations that work that way. TODO Rationalise with reader above.
-
freed
boolean freed
Whether we have already freed resources.
-
-
Method Detail
-
length
public long length() throws java.sql.SQLException
- Specified by:
length
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
truncate
public void truncate(long len) throws java.sql.SQLException
- Specified by:
truncate
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
getAsciiStream
public java.io.InputStream getAsciiStream() throws java.sql.SQLException
- Specified by:
getAsciiStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
setAsciiStream
public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException
- Specified by:
setAsciiStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
getCharacterStream
public java.io.Reader getCharacterStream() throws java.sql.SQLException
- Specified by:
getCharacterStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
setCharacterStream
public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException
- Specified by:
setCharacterStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
free
public void free() throws java.sql.SQLException
Free the Blob object and releases the resources that it holds. The object is invalid once the free method is called.- Specified by:
free
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
- if an error occurs
-
getCharacterStream
public java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLException
Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.- Specified by:
getCharacterStream
in interfacejava.sql.Clob
- Parameters:
pos
- the offset to the first byte of the partial value to be retrieved. The first byte in the Clob is at position 1length
- the length in bytes of the partial value to be retrieved- Throws:
java.sql.SQLException
-
getSubString
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLException
- Specified by:
getSubString
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
setString
public int setString(long pos, java.lang.String str) throws java.sql.SQLException
- Specified by:
setString
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
setString
public int setString(long pos, java.lang.String str, int offset, int len) throws java.sql.SQLException
- Specified by:
setString
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
position
public long position(java.lang.String searchstr, long start) throws java.sql.SQLException
- Specified by:
position
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
position
public long position(java.sql.Clob searchstr, long start) throws java.sql.SQLException
- Specified by:
position
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
-