|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.jdbc.ConnectionChild
org.apache.derby.impl.jdbc.EmbedClob
Implements java.sql.Clob (see the JDBC 2.0 spec). A clob sits on top of a CHAR, VARCHAR or LONG VARCHAR column. If its data is small (less than 1 page) it is a byte array taken from the SQLChar class. If it is large (more than 1 page) it is a long column in the database. The long column is accessed as a stream, and is implemented in store as an OverflowInputStream. The Resetable interface allows sending messages to that stream to initialize itself (reopen its container and lock the corresponding row) and to reset itself to the beginning. NOTE: In the case that the data is large, it is represented as a stream. This stream can be returned to the user in the getAsciiStream() method. This means that we have limited control over the state of the stream, since the user can read bytes from it at any time. Thus all methods here reset the stream to the beginning before doing any work. CAVEAT: The methods may not behave correctly if a user sets up multiple threads and sucks data from the stream (returned from getAsciiStream()) at the same time as calling the Clob methods.
Supports
Field Summary | |
protected static boolean |
CLOSE
|
protected InternalDriver |
factory
Factory for JDBC objects to be created. |
private boolean |
isString
|
protected EmbedConnection |
localConn
|
private java.io.InputStream |
myStream
|
private java.lang.String |
myString
|
protected static boolean |
NOCLOSE
|
Constructor Summary | |
protected |
EmbedClob(DataValueDescriptor dvd,
EmbedConnection con)
|
Method Summary | |
protected void |
commitIfAutoCommit()
Perform a commit if autocommit is enabled. |
protected void |
commitIfNeeded()
Perform a commit if one is needed. |
protected void |
finalize()
|
java.io.InputStream |
getAsciiStream()
Gets the CLOB value designated by this Clob
object as a stream of Ascii bytes. |
protected java.util.Calendar |
getCal()
Get and save a unique calendar object for this JDBC object. |
java.io.Reader |
getCharacterStream()
Gets the Clob contents as a Unicode stream. |
private UTF8Reader |
getCharacterStreamAtPos(long position,
java.lang.Object synchronization)
|
protected java.lang.Object |
getConnectionSynchronization()
Return an object to be used for connection synchronization. |
ContextManager |
getContextManager()
|
Database |
getDatabase()
|
protected EmbedConnection |
getEmbedConnection()
Return a reference to the EmbedConnection |
java.lang.String |
getSubString(long pos,
int length)
Returns a copy of the specified substring in the CLOB value
designated by this Clob object.
|
protected java.sql.SQLException |
handleException(java.lang.Throwable t)
Handle any exception. |
protected java.sql.SQLException |
handleException(java.lang.Throwable t,
boolean close)
Handle any exception. |
long |
length()
Returns the number of characters in the CLOB value
designated by this Clob object. |
protected void |
needCommit()
If Autocommit is on, note that a commit is needed. |
protected java.sql.SQLException |
newSQLException(java.lang.String messageId)
|
protected java.sql.SQLException |
newSQLException(java.lang.String messageId,
java.lang.Object arg1)
|
protected java.sql.SQLException |
newSQLException(java.lang.String messageId,
java.lang.Object arg1,
java.lang.Object arg2)
|
(package private) static java.sql.SQLException |
noStateChangeLOB(java.lang.Throwable t)
|
long |
position(java.sql.Clob searchClob,
long start)
Determines the character position at which the specified Clob object searchstr appears in this
Clob object. |
long |
position(java.lang.String searchStr,
long start)
Determines the character position at which the specified substring searchstr appears in the CLOB . |
protected void |
restoreContextStack()
Setup the context stack (a.k.a. context manager) for this connection. |
java.io.OutputStream |
setAsciiStream(long pos)
JDBC 3.0 Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos. |
java.io.Writer |
setCharacterStream(long pos)
JDBC 3.0 Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, starting at position pos. |
int |
setString(long pos,
java.lang.String parameterName)
JDBC 3.0 Writes the given Java String to the CLOB value that this Clob object designates at the position pos. |
int |
setString(long pos,
java.lang.String str,
int offset,
int len)
JDBC 3.0 Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents. |
protected void |
setupContextStack()
Setup the context stack (a.k.a. context manager) for this connection. |
void |
truncate(long len)
JDBC 3.0 Truncates the CLOB value that this Clob designates to have a length of len characters |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean isString
private java.io.InputStream myStream
private java.lang.String myString
protected static final boolean CLOSE
protected static final boolean NOCLOSE
protected EmbedConnection localConn
protected final InternalDriver factory
Constructor Detail |
protected EmbedClob(DataValueDescriptor dvd, EmbedConnection con) throws StandardException
Method Detail |
public long length() throws java.sql.SQLException
CLOB
value
designated by this Clob
object.
length
in interface java.sql.Clob
CLOB
in characters
java.sql.SQLException
- if there is an error accessing the
length of the CLOB
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLException
CLOB
value
designated by this Clob
object.
The substring begins at position
pos
and has up to length
consecutive
characters.
getSubString
in interface java.sql.Clob
pos
- the first character of the substring to be extracted.
The first character is at position 1.length
- the number of consecutive characters to be copied
String
that is the specified substring in
the CLOB
value designated by this Clob
object
java.sql.SQLException
- if there is an error accessing the
CLOB
NOTE: return the empty string if pos is too largepublic java.io.Reader getCharacterStream() throws java.sql.SQLException
Clob
contents as a Unicode stream.
getCharacterStream
in interface java.sql.Clob
CLOB
data
java.sql.SQLException
- if there is an error accessing the
CLOB
public java.io.InputStream getAsciiStream() throws java.sql.SQLException
CLOB
value designated by this Clob
object as a stream of Ascii bytes.
getAsciiStream
in interface java.sql.Clob
CLOB
data
java.sql.SQLException
- if there is an error accessing the
CLOB
valueprivate UTF8Reader getCharacterStreamAtPos(long position, java.lang.Object synchronization) throws java.io.IOException, StandardException
java.io.IOException
StandardException
public long position(java.lang.String searchStr, long start) throws java.sql.SQLException
searchstr
appears in the CLOB
. The search
begins at position start
.
position
in interface java.sql.Clob
start
- the position at which to begin searching; the first position
is 1
java.sql.SQLException
- if there is an error accessing the
CLOB
valuepublic long position(java.sql.Clob searchClob, long start) throws java.sql.SQLException
Clob
object searchstr
appears in this
Clob
object. The search begins at position
start
.
position
in interface java.sql.Clob
start
- the position at which to begin searching; the first
position is 1
Clob
object appears,
else -1; the first position is 1
java.sql.SQLException
- if there is an error accessing the
CLOB
valueprotected void finalize()
public int setString(long pos, java.lang.String parameterName) throws java.sql.SQLException
setString
in interface java.sql.Clob
pos
- - the position at which to start writing to the CLOB value that
this Clob object represents
java.sql.SQLException
- Feature not implemented for now.public int setString(long pos, java.lang.String str, int offset, int len) throws java.sql.SQLException
setString
in interface java.sql.Clob
pos
- - the position at which to start writing to this Clob objectstr
- - the string to be written to the CLOB value that this Clob designatesoffset
- - the offset into str to start reading the characters to be writtenlen
- - the number of characters to be written
java.sql.SQLException
- Feature not implemented for now.public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException
setAsciiStream
in interface java.sql.Clob
pos
- - the position at which to start writing to this Clob object
java.sql.SQLException
- Feature not implemented for now.public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException
setCharacterStream
in interface java.sql.Clob
pos
- - the position at which to start writing to this Clob object
java.sql.SQLException
- Feature not implemented for now.public void truncate(long len) throws java.sql.SQLException
truncate
in interface java.sql.Clob
len
- - the length, in bytes, to which the CLOB value that this Blob
value should be truncated
java.sql.SQLException
- Feature not implemented for now.static java.sql.SQLException noStateChangeLOB(java.lang.Throwable t)
protected final EmbedConnection getEmbedConnection()
protected final java.lang.Object getConnectionSynchronization()
protected final java.sql.SQLException handleException(java.lang.Throwable t) throws java.sql.SQLException
java.sql.SQLException
- thrown if can't handleEmbedConnection.handleException(java.lang.Throwable)
protected final java.sql.SQLException handleException(java.lang.Throwable t, boolean close) throws java.sql.SQLException
java.sql.SQLException
- thrown if can't handleEmbedConnection.handleException(java.lang.Throwable)
protected final void needCommit()
EmbedConnection.needCommit
protected final void commitIfNeeded() throws java.sql.SQLException
java.sql.SQLException
- thrown on failureEmbedConnection.commitIfNeeded()
protected final void commitIfAutoCommit() throws java.sql.SQLException
java.sql.SQLException
- thrown on failureEmbedConnection.commitIfNeeded()
protected final void setupContextStack() throws java.sql.SQLException
java.sql.SQLException
- thrown on failureEmbedConnection.setupContextStack()
protected final void restoreContextStack() throws java.sql.SQLException
java.sql.SQLException
- thrown on failureEmbedConnection.restoreContextStack()
public ContextManager getContextManager()
public Database getDatabase()
protected java.util.Calendar getCal()
protected java.sql.SQLException newSQLException(java.lang.String messageId)
protected java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1)
protected java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |