Class SqlString

  • public class SqlString
    extends java.lang.Object
    String that represents a kocher SQL statement, expression, or fragment.

    A SqlString just contains a regular Java string, but the SqlString wrapper indicates that the string has been created carefully guarding against all SQL dialect and injection issues.

    The easiest way to do build a SqlString is to use a SqlBuilder.

    • Field Summary

      Modifier and Type Field Description
      private SqlDialect dialect  
      private<java.lang.Integer> dynamicParameters  
      private java.lang.String sql  
    • Constructor Summary

      Constructor Description
      SqlString​(SqlDialect dialect, java.lang.String sql)
      Creates a SqlString.
      SqlString​(SqlDialect dialect, java.lang.String sql,<java.lang.Integer> dynamicParameters)
      Creates a SqlString.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      SqlDialect getDialect()
      Returns the dialect.<java.lang.Integer> getDynamicParameters()
      Returns indices of dynamic parameters.
      java.lang.String getSql()
      Returns the SQL string.
      int hashCode()  
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • sql

        private final java.lang.String sql
      • dynamicParameters

        private<java.lang.Integer> dynamicParameters
    • Constructor Detail

      • SqlString

        public SqlString​(SqlDialect dialect,
                         java.lang.String sql)
        Creates a SqlString.
      • SqlString

        public SqlString​(SqlDialect dialect,
                         java.lang.String sql,
               <java.lang.Integer> dynamicParameters)
        Creates a SqlString. The SQL might contain dynamic parameters, dynamicParameters designate the order of the parameters.
        sql - text
        dynamicParameters - indices
    • Method Detail

      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()

        Returns the SQL string.

        toString in class java.lang.Object
        SQL string
        See Also:
      • getSql

        public java.lang.String getSql()
        Returns the SQL string.
        SQL string
      • getDynamicParameters

        public<java.lang.Integer> getDynamicParameters()
        Returns indices of dynamic parameters.
        indices of dynamic parameters
      • getDialect

        public SqlDialect getDialect()
        Returns the dialect.