Class ParsedSql

java.lang.Object
org.jdbi.v3.core.statement.ParsedSql

public final class ParsedSql extends Object
The SQL and parameters parsed from an SQL statement.
  • Method Details

    • getSql

      public String getSql()
      Returns a SQL string suitable for use with a JDBC PreparedStatement.
      Returns:
      a SQL string suitable for use with a JDBC PreparedStatement.
    • getParameters

      public ParsedParameters getParameters()
      The set of parameters parsed from the input SQL string.
      Returns:
      the set of parameters parsed from the input SQL string.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static ParsedSql of(String sql, ParsedParameters parameters)
      A static factory of ParsedSql instances. The statement may contain only positional parameters (the "?" character). If your SQL code contains named parameters (for example variables preceded by a colon) then you have to replace them with positional parameters and specify the mapping in the ParsedParameters. You cannot mix named and positional parameters in one SQL statement.
      Parameters:
      sql - the SQL code containing only positional parameters
      parameters - the ordered list of named parameters, or positional parameters
      Returns:
      New ParsedSql instance
      See Also:
    • builder

      public static ParsedSql.Builder builder()
      Creates a new ParsedSql builder.
      Returns:
      a builder instance.