Class SqlCharacterValue

java.lang.Object
org.springframework.jdbc.core.support.SqlCharacterValue
All Implemented Interfaces:
SqlTypeValue

public class SqlCharacterValue extends Object implements SqlTypeValue
Object to represent a character-based parameter value for an SQL statement, for example, a character stream for a CLOB/NCLOB or a LONGVARCHAR column.

Designed for use with JdbcTemplate as well as JdbcClient, to be passed in as a parameter value wrapping the target content value.

Can be combined with SqlParameterValue for specifying an SQL type, for example, new SqlParameterValue(Types.CLOB, new SqlCharacterValue(myContent)). With most database drivers, the type hint is not actually necessary.

Note: Only specify Types.CLOB in case of an actual CLOB, preferring Types.LONGVARCHAR otherwise. This is in contrast to SqlLobValue where char sequence handling was lenient.

Since:
6.1.4
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • SqlCharacterValue

      public SqlCharacterValue(CharSequence string)
      Create a new CLOB value with the given content string.
      Parameters:
      string - the content as a String or other CharSequence
    • SqlCharacterValue

      public SqlCharacterValue(char[] characters)
      Create a new SqlCharacterValue for the given content.
      Parameters:
      characters - the content as a character array
    • SqlCharacterValue

      public SqlCharacterValue(Reader reader, long length)
      Create a new SqlCharacterValue for the given content.
      Parameters:
      reader - the content reader
      length - the length of the content (or -1 if undetermined)
    • SqlCharacterValue

      public SqlCharacterValue(InputStream asciiStream, long length)
      Create a new SqlCharacterValue for the given content.
      Parameters:
      asciiStream - the content as ASCII stream
      length - the length of the content (or -1 if undetermined)
  • Method Details