public class DeleteBuilder
extends java.lang.Object
This is not thread safe.
DeleteBuilder builder = DeleteBuilder.newInstance(config);
builder.sql("delete from Emp");
builder.sql("where");
builder.sql("name = ").param(String.class, "SMITH");
builder.sql("and");
builder.sql("salary = ").param(BigDecimal.class, new BigDecimal(1000));
builder.execute();
delete from Emp where name = 'SMITH' and salary = 1000
| Modifier and Type | Method and Description |
|---|---|
void |
callerClassName(java.lang.String className)
Sets the caller class name.
|
void |
callerMethodName(java.lang.String methodName)
Sets the caller method name.
|
int |
execute()
Executes an SQL DELETE statement.
|
Sql<?> |
getSql()
Returns the built SQL.
|
<P> DeleteBuilder |
literal(java.lang.Class<P> paramClass,
P param)
Appends a parameter as literal.
|
<E> DeleteBuilder |
literals(java.lang.Class<E> elementClass,
java.util.List<E> params)
Appends a parameter list as literal.
|
static DeleteBuilder |
newInstance(Config config)
Creates a new instance.
|
<P> DeleteBuilder |
param(java.lang.Class<P> paramClass,
P param)
Appends a parameter.
|
<E> DeleteBuilder |
params(java.lang.Class<E> elementClass,
java.util.List<E> params)
Appends a parameter list.
|
void |
queryTimeout(int queryTimeout)
Sets the query timeout limit in seconds.
|
DeleteBuilder |
removeLast()
Removes the last SQL fragment or parameter.
|
DeleteBuilder |
sql(java.lang.String sql)
Appends an SQL fragment.
|
void |
sqlLogType(SqlLogType sqlLogType)
Sets the SQL log format.
|
public static DeleteBuilder newInstance(Config config)
config - the configurationDomaNullPointerException - if config is nullpublic DeleteBuilder sql(java.lang.String sql)
sql - the SQL fragmentDomaNullPointerException - if sql is nullpublic DeleteBuilder removeLast()
public <P> DeleteBuilder param(java.lang.Class<P> paramClass, P param)
The parameter type must be one of basic types or holder types.
P - the parameter typeparamClass - the parameter classparam - the parameterDomaNullPointerException - if paramClass is nullpublic <E> DeleteBuilder params(java.lang.Class<E> elementClass, java.util.List<E> params)
The element type of the list must be one of basic types or holder types.
E - the element type of the listelementClass - the element class of the listparams - the parameter listDomaNullPointerException - if elementClass or params is nullpublic <P> DeleteBuilder literal(java.lang.Class<P> paramClass, P param)
The parameter type must be one of basic types or holder types.
P - the parameter typeparamClass - the parameter classparam - the parameterDomaNullPointerException - if paramClass is nullpublic <E> DeleteBuilder literals(java.lang.Class<E> elementClass, java.util.List<E> params)
The element type of the list must be one of basic types or holder types.
E - the element type of the listelementClass - the element class of the listparams - the parameter listDomaNullPointerException - if elementClass or params is nullpublic int execute()
JdbcException - if a JDBC related error occurspublic void queryTimeout(int queryTimeout)
If not specified, the value of Config.getQueryTimeout() is used.
queryTimeout - the query timeout limit in secondsStatement.setQueryTimeout(int)public void sqlLogType(SqlLogType sqlLogType)
sqlLogType - the SQL log format typepublic void callerClassName(java.lang.String className)
If not specified, the class name of this instance is used.
className - the caller class nameDomaNullPointerException - if className is nullpublic void callerMethodName(java.lang.String methodName)
if not specified, execute is used.
methodName - the caller method nameDomaNullPointerException - if methodName is nullpublic Sql<?> getSql()