<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_40) on Mon Oct 21 11:07:38 UTC 2013 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>JDBCClob (HSQLDB 2.2.9 API)</title> <meta name="date" content="2013-10-21"> <link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="JDBCClob (HSQLDB 2.2.9 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JDBCClob.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/hsqldb/jdbc/JDBCCallableStatement.html" title="class in org.hsqldb.jdbc"><span class="strong">Prev Class</span></a></li> <li><a href="../../../org/hsqldb/jdbc/JDBCClobClient.html" title="class in org.hsqldb.jdbc"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/hsqldb/jdbc/JDBCClob.html" target="_top">Frames</a></li> <li><a href="JDBCClob.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.hsqldb.jdbc</div> <h2 title="Class JDBCClob" class="title">Class JDBCClob</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.hsqldb.jdbc.JDBCClob</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.sql.Clob</dd> </dl> <dl> <dt>Direct Known Subclasses:</dt> <dd><a href="../../../org/hsqldb/jdbc/JDBCNClob.html" title="class in org.hsqldb.jdbc">JDBCNClob</a></dd> </dl> <hr> <br> <pre>public class <span class="strong">JDBCClob</span> extends java.lang.Object implements java.sql.Clob</pre> <div class="block">The mapping in the Java<sup><font size=-2>TM</font></sup> programming language for the SQL <code>CLOB</code> type. An SQL <code>CLOB</code> 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 a <code>Clob</code> object using an SQL <code>locator(CLOB)</code>, which means that a <code>Clob</code> object contains a logical pointer to the SQL <code>CLOB</code> data rather than the data itself. A <code>Clob</code> object is valid for the duration of the transaction in which it was created. <P>The <code>Clob</code> interface provides methods for getting the length of an SQL <code>CLOB</code> (Character Large Object) value, for materializing a <code>CLOB</code> value on the client, and for searching for a substring or <code>CLOB</code> object within a <code>CLOB</code> value. Methods in the interfaces <code>ResultSet</code>, <code>CallableStatement</code>, and <code>PreparedStatement</code>, such as <code>getClob</code> and <code>setClob</code> allow a programmer to access an SQL <code>CLOB</code> value. In addition, this interface has methods for updating a <code>CLOB</code> value. <p> All methods on the <code>Clob</code> interface must be fully implemented if the JDBC driver supports the data type. <!-- start Release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Previous to 2.0, the HSQLDB driver did not implement Clob using an SQL locator(CLOB). That is, an HSQLDB Clob object did not contain a logical pointer to SQL CLOB data; rather it directly contained a representation of the data (a String). As a result, an HSQLDB Clob object was itself valid beyond the duration of the transaction in which is was created, although it did not necessarily represent a corresponding value on the database. Also, the interface methods for updating a CLOB value were unsupported, with the exception of the truncate method, in that it could be used to truncate the local value. <p> Starting with 2.0, the HSQLDB driver fully supports both local and remote SQL CLOB data implementations, meaning that an HSQLDB Clob object <em>may</em> contain a logical pointer to remote SQL CLOB data (see <a href="../../../org/hsqldb/jdbc/JDBCClobClient.html" title="class in org.hsqldb.jdbc"><code>JDBCClobClient</code></a>) or it may directly contain a local representation of the data (as implemented in this class). In particular, when the product is built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), then the resulting Clob instance is initially disconnected (is not bound to the transaction scope of the vending Connection object), the data is contained directly and all interface methods for updating the CLOB value are supported for local use until the first invocation of free(); otherwise, an HSQLDB Clob's implementation is determined at runtime by the driver, it is typically not valid beyond the duration of the transaction in which is was created, and there no standard way to query whether it represents a local or remote value.<p> </div> <!-- end release-specific documentation --></div> <dl><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd> <dt><span class="strong">Author:</span></dt> <dd>boucherb@users</dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#JDBCClob(java.lang.String)">JDBCClob</a></strong>(java.lang.String data)</code> <div class="block">Constructs a new JDBCClob object wrapping the given character sequence.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#free()">free</a></strong>()</code> <div class="block">This method frees the <code>Clob</code> object and releases the resources the resources that it holds.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.io.InputStream</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getAsciiStream()">getAsciiStream</a></strong>()</code> <div class="block">Retrieves the <code>CLOB</code> value designated by this <code>Clob</code> object as an ASCII stream.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.io.Reader</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getCharacterStream()">getCharacterStream</a></strong>()</code> <div class="block">Retrieves the <code>CLOB</code> value designated by this <code>Clob</code> object as a <code>java.io.Reader</code> object (or as a stream of characters).</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.io.Reader</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getCharacterStream(long, long)">getCharacterStream</a></strong>(long pos, long length)</code> <div class="block">Returns a <code>Reader</code> object that contains a partial <code>Clob</code> value, starting with the character specified by pos, which is length characters in length.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getSubString(long, int)">getSubString</a></strong>(long pos, int length)</code> <div class="block">Retrieves a copy of the specified substring in the <code>CLOB</code> value designated by this <code>Clob</code> object.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#length()">length</a></strong>()</code> <div class="block">Retrieves the number of characters in the <code>CLOB</code> value designated by this <code>Clob</code> object.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#position(java.sql.Clob, long)">position</a></strong>(java.sql.Clob searchstr, long start)</code> <div class="block">Retrieves the character position at which the specified <code>Clob</code> object <code>searchstr</code> appears in this <code>Clob</code> object.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#position(java.lang.String, long)">position</a></strong>(java.lang.String searchstr, long start)</code> <div class="block">Retrieves the character position at which the specified substring <code>searchstr</code> appears in the SQL <code>CLOB</code> value represented by this <code>Clob</code> object.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.io.OutputStream</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setAsciiStream(long)">setAsciiStream</a></strong>(long pos)</code> <div class="block">Retrieves a stream to be used to write ASCII characters to the <code>CLOB</code> value that this <code>Clob</code> object represents, starting at position <code>pos</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.io.Writer</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setCharacterStream(long)">setCharacterStream</a></strong>(long pos)</code> <div class="block">Retrieves a stream to be used to write a stream of Unicode characters to the <code>CLOB</code> value that this <code>Clob</code> object represents, at position <code>pos</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setString(long, java.lang.String)">setString</a></strong>(long pos, java.lang.String str)</code> <div class="block">Writes the given Java <code>String</code> to the <code>CLOB</code> value that this <code>Clob</code> object designates at the position <code>pos</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setString(long, java.lang.String, int, int)">setString</a></strong>(long pos, java.lang.String str, int offset, int len)</code> <div class="block">Writes <code>len</code> characters of <code>str</code>, starting at character <code>offset</code>, to the <code>CLOB</code> value that this <code>Clob</code> represents.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCClob.html#truncate(long)">truncate</a></strong>(long len)</code> <div class="block">Truncates the <code>CLOB</code> value that this <code>Clob</code> designates to have a length of <code>len</code> characters.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="JDBCClob(java.lang.String)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>JDBCClob</h4> <pre>public JDBCClob(java.lang.String data) throws java.sql.SQLException</pre> <div class="block">Constructs a new JDBCClob object wrapping the given character sequence. <p> This constructor is used internally to retrieve result set values as Clob objects, yet it must be public to allow access from other packages. As such (in the interest of efficiency) this object maintains a reference to the given String object rather than making a copy and so it is gently suggested (in the interest of effective memory management) that external clients using this constructor either take pause to consider the implications or at least take care to provide a String object whose internal character buffer is not much larger than required to represent the value.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - the character sequence representing the Clob value</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if the argument is null</dd></dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="length()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>length</h4> <pre>public long length() throws java.sql.SQLException</pre> <div class="block">Retrieves the number of characters in the <code>CLOB</code> value designated by this <code>Clob</code> object.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>length</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Returns:</span></dt><dd>length of the <code>CLOB</code> in characters</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the length of the <code>CLOB</code> value</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="getSubString(long, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSubString</h4> <pre>public java.lang.String getSubString(long pos, int length) throws java.sql.SQLException</pre> <div class="block">Retrieves a copy of the specified substring in the <code>CLOB</code> value designated by this <code>Clob</code> object. The substring begins at position <code>pos</code> and has up to <code>length</code> consecutive characters. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> The official specification above is ambiguous in that it does not precisely indicate the policy to be observed when pos > this.length() - length. One policy would be to retrieve the characters from pos to this.length(). Another would be to throw an exception. HSQLDB observes the second policy. <p> <b>Note</b><p> Depending java.lang.String implementation, the returned value may be sharing the underlying (and possibly much larger) character buffer. This facilitates much faster operation and will save memory if many transient substrings are to be retrieved during processing, but it has memory management implications should retrieved substrings be required to survive for any non-trivial duration. It is left up to the client to decide how to handle the trade-off (whether to make an isolated copy of the returned substring or risk that more memory remains allocated than is absolutely required). </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getSubString</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the first character of the substring to be extracted. The first character is at position 1.</dd><dd><code>length</code> - the number of consecutive characters to be copied; JDBC 4.1[ the value for length must be 0 or greater]</dd> <dt><span class="strong">Returns:</span></dt><dd>a <code>String</code> that is the specified substring in the <code>CLOB</code> value designated by this <code>Clob</code> object</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value; if pos is less than 1 JDBC 4.1[or length is less than 0]</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="getCharacterStream()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getCharacterStream</h4> <pre>public java.io.Reader getCharacterStream() throws java.sql.SQLException</pre> <div class="block">Retrieves the <code>CLOB</code> value designated by this <code>Clob</code> object as a <code>java.io.Reader</code> object (or as a stream of characters).</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getCharacterStream</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Returns:</span></dt><dd>a <code>java.io.Reader</code> object containing the <code>CLOB</code> data</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setCharacterStream(long)"><code>setCharacterStream(long)</code></a></dd></dl> </li> </ul> <a name="getAsciiStream()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getAsciiStream</h4> <pre>public java.io.InputStream getAsciiStream() throws java.sql.SQLException</pre> <div class="block">Retrieves the <code>CLOB</code> value designated by this <code>Clob</code> object as an ASCII stream.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getAsciiStream</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Returns:</span></dt><dd>a <code>java.io.InputStream</code> object containing the <code>CLOB</code> data</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCClob.html#setAsciiStream(long)"><code>setAsciiStream(long)</code></a></dd></dl> </li> </ul> <a name="position(java.lang.String, long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>position</h4> <pre>public long position(java.lang.String searchstr, long start) throws java.sql.SQLException</pre> <div class="block">Retrieves the character position at which the specified substring <code>searchstr</code> appears in the SQL <code>CLOB</code> value represented by this <code>Clob</code> object. The search begins at position <code>start</code>.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>position</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>searchstr</code> - the substring for which to search</dd><dd><code>start</code> - the position at which to begin searching; the first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>the position at which the substring appears or -1 if it is not present; the first position is 1</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if start is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="position(java.sql.Clob, long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>position</h4> <pre>public long position(java.sql.Clob searchstr, long start) throws java.sql.SQLException</pre> <div class="block">Retrieves the character position at which the specified <code>Clob</code> object <code>searchstr</code> appears in this <code>Clob</code> object. The search begins at position <code>start</code>.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>position</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>searchstr</code> - the <code>Clob</code> object for which to search</dd><dd><code>start</code> - the position at which to begin searching; the first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>the position at which the <code>Clob</code> object appears or -1 if it is not present; the first position is 1</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if start is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="setString(long, java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setString</h4> <pre>public int setString(long pos, java.lang.String str) throws java.sql.SQLException</pre> <div class="block">Writes the given Java <code>String</code> to the <code>CLOB</code> value that this <code>Clob</code> object designates at the position <code>pos</code>. The string will overwrite the existing characters in the <code>Clob</code> object starting at the position <code>pos</code>. If the end of the <code>Clob</code> value is reached while writing the given string, then the length of the <code>Clob</code> value will be increased to accommodate the extra characters. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>CLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with HSQLDB 2.0 this feature is supported. <p> When built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), this operation affects only the client-side value; it has no effect upon a value stored in the database because JDBCConnection.createClob() constructs disconnected, initially empty Clob instances. To propagate the Clob value to a database in this case, it is required to supply the Clob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Clob instance to an updateXXX method of an updateable ResultSet. <p> <b>Implementation Notes:</b><p> No attempt is made to ensure precise thread safety. Instead, volatile member field and local variable snapshot isolation semantics are implemented. This is expected to eliminate most issues related to race conditions, with the possible exception of concurrent invocation of free(). <p> In general, however, if an application may perform concurrent JDBCClob modifications and the integrity of the application depends on total order Clob modification semantics, then such operations should be synchronized on an appropriate monitor.<p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setString</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position at which to start writing to the <code>CLOB</code> value that this <code>Clob</code> object represents; The first position is 1</dd><dd><code>str</code> - the string to be written to the <code>CLOB</code> value that this <code>Clob</code> designates</dd> <dt><span class="strong">Returns:</span></dt><dd>the number of characters written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="setString(long, java.lang.String, int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setString</h4> <pre>public int setString(long pos, java.lang.String str, int offset, int len) throws java.sql.SQLException</pre> <div class="block">Writes <code>len</code> characters of <code>str</code>, starting at character <code>offset</code>, to the <code>CLOB</code> value that this <code>Clob</code> represents. The string will overwrite the existing characters in the <code>Clob</code> object starting at the position <code>pos</code>. If the end of the <code>Clob</code> value is reached while writing the given string, then the length of the <code>Clob</code> value will be increased to accommodate the extra characters. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>CLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with HSQLDB 2.0 this feature is supported. <p> When built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), this operation affects only the client-side value; it has no effect upon a value stored in a database because JDBCConnection.createClob() constructs disconnected, initially empty Clob instances. To propagate the Clob value to a database in this case, it is required to supply the Clob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Clob instance to an updateXXX method of an updateable ResultSet. <p> <b>Implementation Notes:</b><p> If the value specified for <code>pos</code> is greater than the length of the <code>CLOB</code> value, then the <code>CLOB</code> value is extended in length to accept the written characters and the undefined region up to <code>pos</code> is filled with (char)0. <p> No attempt is made to ensure precise thread safety. Instead, volatile member field and local variable snapshot isolation semantics are implemented. This is expected to eliminate most issues related to race conditions, with the possible exception of concurrent invocation of free(). <p> In general, however, if an application may perform concurrent JDBCClob modifications and the integrity of the application depends on total order Clob modification semantics, then such operations should be synchronized on an appropriate monitor.<p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setString</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position at which to start writing to this <code>CLOB</code> object; The first position is 1</dd><dd><code>str</code> - the string to be written to the <code>CLOB</code> value that this <code>Clob</code> object represents</dd><dd><code>offset</code> - the offset into <code>str</code> to start reading the characters to be written</dd><dd><code>len</code> - the number of characters to be written</dd> <dt><span class="strong">Returns:</span></dt><dd>the number of characters written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="setAsciiStream(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setAsciiStream</h4> <pre>public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException</pre> <div class="block">Retrieves a stream to be used to write ASCII characters to the <code>CLOB</code> value that this <code>Clob</code> object represents, starting at position <code>pos</code>. Characters written to the stream will overwrite the existing characters in the <code>Clob</code> object starting at the position <code>pos</code>. If the end of the <code>Clob</code> value is reached while writing characters to the stream, then the length of the <code>Clob</code> value will be increased to accommodate the extra characters. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater than the length of the <code>CLOB</code> value, then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with HSQLDB 2.0 this feature is supported. <p> When built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), this operation affects only the client-side value; it has no effect upon a value stored in a database because JDBCConnection.createClob() constructs disconnected, initially empty Clob instances. To propagate the Clob value to a database in this case, it is required to supply the Clob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Clob instance to an updateXXX method of an updateable ResultSet. <p> <b>Implementation Notes:</b><p> The data written to the stream does not appear in this Clob until the stream is closed. <p> When the stream is closed, if the value specified for <code>pos</code> is greater than the length of the <code>CLOB</code> value, then the <code>CLOB</code> value is extended in length to accept the written characters and the undefined region up to <code>pos</code> is filled with (char)0. <p> Also, no attempt is made to ensure precise thread safety. Instead, volatile member field and local variable snapshot isolation semantics are implemented. This is expected to eliminate most issues related to race conditions, with the possible exception of concurrent invocation of free(). <p> In general, however, if an application may perform concurrent JDBCClob modifications and the integrity of the application depends on total order Clob modification semantics, then such operations should be synchronized on an appropriate monitor.<p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setAsciiStream</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position at which to start writing to this <code>CLOB</code> object; The first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>the stream to which ASCII encoded characters can be written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4, HSQLDB 1.7.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getAsciiStream()"><code>getAsciiStream()</code></a></dd></dl> </li> </ul> <a name="setCharacterStream(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setCharacterStream</h4> <pre>public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException</pre> <div class="block">Retrieves a stream to be used to write a stream of Unicode characters to the <code>CLOB</code> value that this <code>Clob</code> object represents, at position <code>pos</code>. Characters written to the stream will overwrite the existing characters in the <code>Clob</code> object starting at the position <code>pos</code>. If the end of the <code>Clob</code> value is reached while writing characters to the stream, then the length of the <code>Clob</code> value will be increased to accommodate the extra characters. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>CLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with HSQLDB 2.0 this feature is supported. <p> When built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), this operation affects only the client-side value; it has no effect upon a value stored in a database because JDBCConnection.createClob() constructs disconnected, initially empty Clob instances. To propagate the Clob value to a database in this case, it is required to supply the Clob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Clob instance to an updateXXX method of an updateable ResultSet. <p> <b>Implementation Notes:</b><p> The data written to the stream does not appear in this Clob until the stream is closed. <p> When the stream is closed, if the value specified for <code>pos</code> is greater than the length of the <code>CLOB</code> value, then the <code>CLOB</code> value is extended in length to accept the written characters and the undefined region up to <code>pos</code> is filled with (char)0. <p> Also, no attempt is made to ensure precise thread safety. Instead, volatile member field and local variable snapshot isolation semantics are implemented. This is expected to eliminate most issues related to race conditions, with the possible exception of concurrent invocation of free(). <p> In general, however, if an application may perform concurrent JDBCClob modifications and the integrity of the application depends on total order Clob modification semantics, then such operations should be synchronized on an appropriate monitor.<p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setCharacterStream</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position at which to start writing to the <code>CLOB</code> value; The first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>a stream to which Unicode encoded characters can be written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4, HSQLDB 1.7.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCClob.html#getCharacterStream()"><code>getCharacterStream()</code></a></dd></dl> </li> </ul> <a name="truncate(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>truncate</h4> <pre>public void truncate(long len) throws java.sql.SQLException</pre> <div class="block">Truncates the <code>CLOB</code> value that this <code>Clob</code> designates to have a length of <code>len</code> characters. <p> <b>Note:</b> If the value specified for <code>len</code> is greater than the length of the <code>CLOB</code> value, then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with HSQLDB 2.0 this feature is fully supported. <p> When built under JDK 1.6+ and the Clob instance is constructed as a result of calling JDBCConnection.createClob(), this operation affects only the client-side value; it has no effect upon a value stored in a database because JDBCConnection.createClob() constructs disconnected, initially empty Blob instances. To propagate the truncated Clob value to a database in this case, it is required to supply the Clob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Blob instance to an updateXXX method of an updateable ResultSet. <p> <b>Implementation Notes:</b> <p> HSQLDB throws an SQLException if the specified <tt>len</tt> is greater than the value returned by <a href="../../../org/hsqldb/jdbc/JDBCClob.html#length()"><code>length</code></a>. <p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>truncate</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>len</code> - the length, in characters, to which the <code>CLOB</code> value should be truncated</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>CLOB</code> value or if len is less than 0</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4, HSQLDB 1.7.2</dd></dl> </li> </ul> <a name="free()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>free</h4> <pre>public void free() throws java.sql.SQLException</pre> <div class="block">This method frees the <code>Clob</code> object and releases the resources the resources that it holds. The object is invalid once the <code>free</code> method is called. <p> After <code>free</code> has been called, any attempt to invoke a method other than <code>free</code> will result in a <code>SQLException</code> being thrown. If <code>free</code> is called multiple times, the subsequent calls to <code>free</code> are treated as a no-op. <p></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>free</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if an error occurs releasing the Clob's resources</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.6, HSQLDB 2.0</dd></dl> </li> </ul> <a name="getCharacterStream(long, long)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getCharacterStream</h4> <pre>public java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLException</pre> <div class="block">Returns a <code>Reader</code> object that contains a partial <code>Clob</code> value, starting with the character specified by pos, which is length characters in length.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getCharacterStream</code> in interface <code>java.sql.Clob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the offset to the first character of the partial value to be retrieved. The first character in the Clob is at position 1.</dd><dd><code>length</code> - the length in characters of the partial value to be retrieved.</dd> <dt><span class="strong">Returns:</span></dt><dd><code>Reader</code> through which the partial <code>Clob</code> value can be read.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if pos is less than 1 or if pos is greater than the number of characters in the <code>Clob</code> or if pos + length is greater than the number of characters in the <code>Clob</code></dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.6, HSQLDB 2.0</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JDBCClob.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/hsqldb/jdbc/JDBCCallableStatement.html" title="class in org.hsqldb.jdbc"><span class="strong">Prev Class</span></a></li> <li><a href="../../../org/hsqldb/jdbc/JDBCClobClient.html" title="class in org.hsqldb.jdbc"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/hsqldb/jdbc/JDBCClob.html" target="_top">Frames</a></li> <li><a href="JDBCClob.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><i>Copyright �� 2001 - 2010 HSQL Development Group.</i></small></p> </body> </html>