public interface Sql
Represents the generated SQL statement with parameters.
-
Method Summary
Modifier and TypeMethodDescriptionA bind variables object that can be used to add bind variables to a batch, if available.bindVariables(SqlTemplate.BindVariables bindVariables) Returns a new instance of the SQL statement with the given bind variables.The primary key that have been auto generated as part of in insert statement.generatedKeys(List<String> generatedKeys) Returns a new instance of the SQL statement with the given generated keys.The parameters that were used to generate the SQL.parameters(List<SqlTemplate.Parameter> parameters) Returns a new instance of the SQL statement with the given parameters.The generated SQL with all parameters replaced by '?'Returns a new instance of the SQL statement with the given statement.Returns a warning message if the statement is deemed potentially unsafe, an empty optional otherwise.unsafeWarning(String unsafeWarning) Returns a new instance of the SQL statement with the given unsafe warning message.booleanReturnstrueif the statement is version aware,falseotherwise.versionAware(boolean versionAware) Returns a new instance of the SQL statement with the version aware flag set to the given value.
-
Method Details
-
statement
String statement()The generated SQL with all parameters replaced by '?' or named ':name' placeholders. -
statement
Returns a new instance of the SQL statement with the given statement.- Parameters:
statement- the new SQL statement.- Returns:
- a new instance of the SQL statement with the given statement.
-
parameters
List<SqlTemplate.Parameter> parameters()The parameters that were used to generate the SQL. -
parameters
Returns a new instance of the SQL statement with the given parameters.- Parameters:
parameters- the new parameters.- Returns:
- a new instance of the SQL statement with the given parameters.
-
bindVariables
Optional<SqlTemplate.BindVariables> bindVariables()A bind variables object that can be used to add bind variables to a batch, if available. -
bindVariables
Returns a new instance of the SQL statement with the given bind variables.- Parameters:
bindVariables- the new bind variables- Returns:
- a new instance of the SQL statement with the given bind variables
-
generatedKeys
The primary key that have been auto generated as part of in insert statement.Note that the generated keys are only set when the SQL is generated using an
Elements.Insertelement, either directly or indirectly usingElements.Table. -
generatedKeys
Returns a new instance of the SQL statement with the given generated keys.- Parameters:
generatedKeys- the new generated keys- Returns:
- a new instance of the SQL statement with the given generated keys
- Since:
- 1.2
-
versionAware
boolean versionAware()Returnstrueif the statement is version aware,falseotherwise.Note that the version aware flag is only set when the SQL is generated using a
Elements.Setelement. -
versionAware
Returns a new instance of the SQL statement with the version aware flag set to the given value.- Parameters:
versionAware- the new value of the version aware flag.- Returns:
- a new instance of the SQL statement with the version aware flag set to the given value
- Since:
- 1.2
-
unsafeWarning
Returns a warning message if the statement is deemed potentially unsafe, an empty optional otherwise.- Since:
- 1.2
-
unsafeWarning
Returns a new instance of the SQL statement with the given unsafe warning message.- Parameters:
unsafeWarning- the new unsafe warning message- Returns:
- a new instance of the SQL statement with the given unsafe warning message
- Since:
- 1.2
-