Package org.jdbi.v3.core
Class Sql
java.lang.Object
org.jdbi.v3.core.Sql
- All Implemented Interfaces:
- CharSequence
An immutable sql statement string created from multiple tokens in order to write inline sql statements in an easy-to-read fashion spread out over multiple lines of code.
   The class implements CharSequence and thus can be used as a drop-in
   alternative wherever API supports CharSequence rather than String.
 
null or empty inputs are permitted (no run-time exceptions).The input of multiple tokens is formatted into a single String by removing leading and trailing whitespace and concatenating non-empty tokens by a single space character. Further, any trailing semicolons are removed from the resulting sql string.
Example:
     String tblName = "table";
     Sql.of("SELECT COUNT(*)",
            "FROM", tblName,
            " WHERE cond1 = :cond1",
            "   AND cond2 = :cond2");
 - 
Method SummaryModifier and TypeMethodDescriptioncharcharAt(int index) booleaninthashCode()intlength()static Sqlof(CharSequence... tokens) static Sqlof(Iterable<? extends CharSequence> tokens) subSequence(int start, int end) toString()Methods inherited from interface java.lang.CharSequencechars, codePoints, isEmpty
- 
Method Details- 
of
- 
of
- 
lengthpublic int length()- Specified by:
- lengthin interface- CharSequence
 
- 
charAtpublic char charAt(int index) - Specified by:
- charAtin interface- CharSequence
 
- 
subSequence- Specified by:
- subSequencein interface- CharSequence
 
- 
hashCodepublic int hashCode()
- 
equals
- 
toString- Specified by:
- toStringin interface- CharSequence
- Overrides:
- toStringin class- Object
 
 
-