public final class ClobImpl extends Object implements Clob, Serializable
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.
Modifier and Type | Method and Description |
---|---|
void |
free() |
InputStream |
getAsciiStream()
Retrieves the
CLOB value designated by this
Clob instance as a stream. |
Reader |
getCharacterStream()
Materializes the
CLOB value designated by this object
as a stream of Unicode character. |
Reader |
getCharacterStream(long pos,
long len) |
String |
getSubString(long pos,
int length)
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. |
long |
length()
Returns the size of the
CLOB value designated by this
Clob object |
long |
position(Clob searchstr,
long start)
Retrieves the character position at which the specified
Clob
object searchstr begins within the CLOB value
that this Clob object represents. |
long |
position(String searchstr,
long start)
Retrieves the character position at which the specified string
searchstr begins within the CLOB value that
this Clob object represents. |
OutputStream |
setAsciiStream(long pos)
Retrieves a stream to be used to write Ascii characters to the CLOB value
that this Clob object represents, starting at position pos.
|
Writer |
setCharacterStream(long pos)
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.
|
int |
setString(long pos,
String str)
Writes the given Java String to the CLOB value that this Clob object
designates at the position pos.
|
int |
setString(long pos,
String str,
int offset,
int len)
Writes len characters of str, starting at character offset, to the CLOB
value that this Clob represents.
|
static Clob |
toClob(Object value)
cast given value to a clob
|
static Clob |
toClob(String value) |
String |
toString() |
void |
truncate(long len)
Truncates the CLOB value that this Clob designates to have a length of len
characters.
|
public static Clob toClob(Object value) throws PageException
value
- PageException
public long length() throws SQLException
CLOB
value designated by this
Clob
objectlength
in interface Clob
CLOB
value that this clob
representsSQLException
- if there is an error accessing the length of the
CLOB
public InputStream getAsciiStream() throws SQLException
CLOB
value designated by this
Clob
instance as a stream.getAsciiStream
in interface Clob
CLOB
dataSQLException
- if there is an error accessing the
CLOB
valuepublic Reader getCharacterStream() throws SQLException
CLOB
value designated by this object
as a stream of Unicode character.
getCharacterStream
in interface Clob
CLOB
value
designated by this clob object as unicode characters.SQLException
- if there is an error accessing the
CLOB
valuepublic Reader getCharacterStream(long pos, long len)
getCharacterStream
in interface Clob
public String getSubString(long pos, int length) throws SQLException
CLOB
value represented
by this CLOB
object that starts at position position
and has ip to length consecutive characters.getSubString
in interface Clob
pos
- the position where to get the substring fromlength
- the length of the substringSQLException
- if there is an error accessing the
CLOB
public long position(String searchstr, long start) throws SQLException
searchstr
begins within the CLOB
value that
this Clob
object represents. The search for
searchstr
begins at position start
.position
in interface Clob
searchstr
- the byte array for which to searchstart
- the position at which to begin searching; the first position
is 1SQLException
- if there is an error accessing the
CLOB
public long position(Clob searchstr, long start) throws SQLException
Clob
object searchstr
begins within the CLOB
value
that this Clob
object represents. The search for
searchstr
begins at position start
.position
in interface Clob
searchstr
- the byte array for which to searchstart
- the position at which to begin searching; the first position
is 1SQLException
- if there is an error accessing the
CLOB
public OutputStream setAsciiStream(long pos) throws SQLException
setAsciiStream
in interface Clob
pos
- the position where to start the streamclob
objectSQLException
- if there is an error accessing the clob
public Writer setCharacterStream(long pos) throws SQLException
setCharacterStream
in interface Clob
pos
- the position where to start the writerclob
objectSQLException
- if there is an error accessing the clob
public int setString(long pos, String str) throws SQLException
setString
in interface Clob
pos
- the position where to set the stringstr
- string to insert in the clob
SQLException
- if there is an error accessing the clob
public int setString(long pos, String str, int offset, int len) throws SQLException
setString
in interface Clob
pos
- the positionstr
- the stringoffset
- the offsetlen
- the lengthSQLException
- if there is an error accessing the clob
public void truncate(long len) throws SQLException
truncate
in interface Clob
len
- the lengthSQLException
- if there is an error accessing the clob
Copyright © 2015 Lucee