1. /*
  2. * @(#)Clob.java 1.17 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.sql;
  11. /**
  12. * The mapping in the Java<sup><font size=-2>TM</font></sup> programming language
  13. * for the SQL <code>CLOB</code> type.
  14. * An SQL <code>CLOB</code> is a built-in type
  15. * that stores a Character Large Object as a column value in a row of
  16. * a database table.
  17. * The driver implements a <code>Clob</code> object using an SQL
  18. * <code>locator(CLOB)</code>, which means that a <code>Clob</code> object
  19. * contains a logical pointer to the SQL <code>CLOB</code> data rather than
  20. * the data itself. A <code>Clob</code> object is valid for the duration
  21. * of the transaction in which it was created.
  22. * <P>The <code>Clob</code> interface provides methods for getting the
  23. * length of an SQL <code>CLOB</code> (Character Large Object) value,
  24. * for materializing a <code>CLOB</code> value on the client, and for
  25. * searching for a substring or <code>CLOB</code> object within a
  26. * <code>CLOB</code> value.
  27. * Methods in the interfaces {@link ResultSet},
  28. * {@link CallableStatement}, and {@link PreparedStatement}, such as
  29. * <code>getClob</code> and <code>setClob</code> allow a programmer to
  30. * access an SQL <code>CLOB</code> value.
  31. <P>
  32. * This class is new in the JDBC 2.0 API.
  33. */
  34. public interface Clob {
  35. /**
  36. * Returns the number of characters
  37. * in the <code>CLOB</code> value
  38. * designated by this <code>Clob</code> object.
  39. * @return length of the <code>CLOB</code> in characters
  40. * @exception SQLException if there is an error accessing the
  41. * length of the <code>CLOB</code>
  42. * @since 1.2
  43. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  44. */
  45. long length() throws SQLException;
  46. /**
  47. * Returns a copy of the specified substring
  48. * in the <code>CLOB</code> value
  49. * designated by this <code>Clob</code> object.
  50. * The substring begins at position
  51. * <code>pos</code> and has up to <code>length</code> consecutive
  52. * characters.
  53. * @param pos the first character of the substring to be extracted.
  54. * The first character is at position 1.
  55. * @param length the number of consecutive characters to be copied
  56. * @return a <code>String</code> that is the specified substring in
  57. * the <code>CLOB</code> value designated by this <code>Clob</code> object
  58. * @exception SQLException if there is an error accessing the
  59. * <code>CLOB</code>
  60. * @since 1.2
  61. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  62. */
  63. String getSubString(long pos, int length) throws SQLException;
  64. /**
  65. * Gets the <code>CLOB</code> value designated by this <code>Clob</code>
  66. * object as a Unicode stream.
  67. * @return a Unicode stream containing the <code>CLOB</code> data
  68. * @exception SQLException if there is an error accessing the
  69. * <code>CLOB</code> value
  70. * @since 1.2
  71. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  72. */
  73. java.io.Reader getCharacterStream() throws SQLException;
  74. /**
  75. * Gets the <code>CLOB</code> value designated by this <code>Clob</code>
  76. * object as a stream of Ascii bytes.
  77. * @return an ascii stream containing the <code>CLOB</code> data
  78. * @exception SQLException if there is an error accessing the
  79. * <code>CLOB</code> value
  80. * @since 1.2
  81. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  82. */
  83. java.io.InputStream getAsciiStream() throws SQLException;
  84. /**
  85. * Determines the character position at which the specified substring
  86. * <code>searchstr</code> appears in the SQL <code>CLOB</code> value
  87. * represented by this <code>Clob</code> object. The search
  88. * begins at position <code>start</code>.
  89. * @param searchstr the substring for which to search
  90. * @param start the position at which to begin searching; the first position
  91. * is 1
  92. * @return the position at which the substring appears, else -1; the first
  93. * position is 1
  94. * @exception SQLException if there is an error accessing the
  95. * <code>CLOB</code> value
  96. * @since 1.2
  97. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  98. */
  99. long position(String searchstr, long start) throws SQLException;
  100. /**
  101. * Determines the character position at which the specified
  102. * <code>Clob</code> object <code>searchstr</code> appears in this
  103. * <code>Clob</code> object. The search begins at position
  104. * <code>start</code>.
  105. * @param searchstr the <code>Clob</code> object for which to search
  106. * @param start the position at which to begin searching; the first
  107. * position is 1
  108. * @return the position at which the <code>Clob</code> object appears,
  109. * else -1; the first position is 1
  110. * @exception SQLException if there is an error accessing the
  111. * <code>CLOB</code> value
  112. * @since 1.2
  113. * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a>
  114. */
  115. long position(Clob searchstr, long start) throws SQLException;
  116. }