java.lang.Object
io.ebeaninternal.server.core.DefaultSqlUpdate
- All Implemented Interfaces:
SqlUpdate,SpiSqlUpdate,Serializable
A SQL Update Delete or Insert statement that can be executed. For the times
when you want to use Sql DML rather than a ORM bean approach. Refer to the
Ebean execute() method.
There is also Update which is similar except should use logical bean and
property names rather than physical table and column names.
SqlUpdate is designed for general DML sql and CallableSql is designed for use with stored procedures.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSqlUpdate(SpiEbeanServer server, String sql) Create with a specific server.DefaultSqlUpdate(SpiEbeanServer server, String sql, BindParams bindParams) Create with server sql and bindParams object.DefaultSqlUpdate(String sql) Create with some sql. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()baseSql()Return the sql taking into account bind parameter expansion.Return the bind parameters.copy()Return a copy of the SqlUpdate with empty bind parameters.intexecute()int[]intgetLabel()getSql()intbooleanbooleanReturn true if we are using getGeneratedKeys.voidreset()Reset bind position to be ready for another bind execute.setArrayParameter(String name, Collection<?> values) setAutoTableMod(boolean isAutoTableMod) voidsetGeneratedKey(Object idValue) Set the generated key value.voidsetGeneratedSql(String generatedSql) Set the final sql being executed with named parameters replaced etc.setGetGeneratedKeys(boolean getGeneratedKeys) setNull(int position, int jdbcType) setNullParameter(int position, int jdbcType) setNullParameter(String name, int jdbcType) setParameter(int position, Object value) setParameter(Object value) setParameter(String name, Object param) setParameters(Object... values) setTimeout(int secs)
-
Constructor Details
-
DefaultSqlUpdate
Create with server sql and bindParams object.Useful if you are building the sql and binding parameters at the same time.
-
DefaultSqlUpdate
Create with a specific server. This means you can use the SqlUpdate.execute() method. -
DefaultSqlUpdate
Create with some sql.
-
-
Method Details
-
copy
Description copied from interface:SpiSqlUpdateReturn a copy of the SqlUpdate with empty bind parameters.- Specified by:
copyin interfaceSpiSqlUpdate
-
reset
public void reset()Description copied from interface:SpiSqlUpdateReset bind position to be ready for another bind execute.- Specified by:
resetin interfaceSpiSqlUpdate
-
executeGetKey
- Specified by:
executeGetKeyin interfaceSqlUpdate
-
execute
public int execute() -
executeNow
public int executeNow()- Specified by:
executeNowin interfaceSqlUpdate
-
executeBatch
public int[] executeBatch()- Specified by:
executeBatchin interfaceSqlUpdate
-
addBatch
public void addBatch() -
getGeneratedKey
- Specified by:
getGeneratedKeyin interfaceSqlUpdate
-
setGeneratedKey
Description copied from interface:SpiSqlUpdateSet the generated key value.- Specified by:
setGeneratedKeyin interfaceSpiSqlUpdate
-
isAutoTableMod
public boolean isAutoTableMod()- Specified by:
isAutoTableModin interfaceSqlUpdate
-
setAutoTableMod
- Specified by:
setAutoTableModin interfaceSqlUpdate
-
getLabel
-
setLabel
-
isGetGeneratedKeys
public boolean isGetGeneratedKeys()Description copied from interface:SpiSqlUpdateReturn true if we are using getGeneratedKeys.- Specified by:
isGetGeneratedKeysin interfaceSpiSqlUpdate
-
setGetGeneratedKeys
- Specified by:
setGetGeneratedKeysin interfaceSqlUpdate
-
getGeneratedSql
- Specified by:
getGeneratedSqlin interfaceSqlUpdate
-
setGeneratedSql
Description copied from interface:SpiSqlUpdateSet the final sql being executed with named parameters replaced etc.- Specified by:
setGeneratedSqlin interfaceSpiSqlUpdate
-
getSql
-
baseSql
Description copied from interface:SpiSqlUpdateReturn the sql taking into account bind parameter expansion.- Specified by:
baseSqlin interfaceSpiSqlUpdate
-
getTimeout
public int getTimeout()- Specified by:
getTimeoutin interfaceSqlUpdate
-
setTimeout
- Specified by:
setTimeoutin interfaceSqlUpdate
-
setParameters
- Specified by:
setParametersin interfaceSqlUpdate
-
setParameter
- Specified by:
setParameterin interfaceSqlUpdate
-
setParameter
- Specified by:
setParameterin interfaceSqlUpdate
-
setNull
-
setNullParameter
- Specified by:
setNullParameterin interfaceSqlUpdate
-
setParameter
- Specified by:
setParameterin interfaceSqlUpdate
-
setArrayParameter
- Specified by:
setArrayParameterin interfaceSqlUpdate
-
setNull
-
setNullParameter
- Specified by:
setNullParameterin interfaceSqlUpdate
-
bindParams
Return the bind parameters.- Specified by:
bindParamsin interfaceSpiSqlUpdate
-