Class DefaultCallableSql
- java.lang.Object
-
- io.ebeaninternal.server.core.DefaultCallableSql
-
- All Implemented Interfaces:
CallableSql
,SpiCallableSql
,Serializable
public class DefaultCallableSql extends Object implements Serializable, SpiCallableSql
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultCallableSql(EbeanServer server, String sql)
Create with callable sql.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CallableSql
addModification(String tableName, boolean inserts, boolean updates, boolean deletes)
Add table modification information to the TransactionEvent.CallableSql
bind(int position, Object value)
Bind a parameter that is bound as a IN parameter.void
execute()
boolean
executeOverride(CallableStatement cstmt)
You can extend this object and override this method for more advanced stored procedure calls.BindParams
getBindParams()
String
getLabel()
Return the label that is put into the transaction log.Object
getObject(int position)
Return an OUT parameter value.String
getSql()
Return the callable sql.int
getTimeout()
Return the statement execution timeout.TransactionEventTable
getTransactionEventTable()
Return the TransactionEvent which holds the table modification information for this CallableSql.CallableSql
registerOut(int position, int type)
Register an OUT parameter.CallableSql
setLabel(String label)
Set the label that is put in the transaction log.CallableSql
setParameter(int position, Object value)
Bind a positioned parameter (same as bind method).CallableSql
setSql(String sql)
Set the callable sql.CallableSql
setTimeout(int secs)
Set the statement execution timeout.
-
-
-
Constructor Detail
-
DefaultCallableSql
public DefaultCallableSql(EbeanServer server, String sql)
Create with callable sql.
-
-
Method Detail
-
execute
public void execute()
-
getLabel
public String getLabel()
Description copied from interface:CallableSql
Return the label that is put into the transaction log.- Specified by:
getLabel
in interfaceCallableSql
-
setLabel
public CallableSql setLabel(String label)
Description copied from interface:CallableSql
Set the label that is put in the transaction log.- Specified by:
setLabel
in interfaceCallableSql
-
getTimeout
public int getTimeout()
Description copied from interface:CallableSql
Return the statement execution timeout.- Specified by:
getTimeout
in interfaceCallableSql
-
getSql
public String getSql()
Description copied from interface:CallableSql
Return the callable sql.- Specified by:
getSql
in interfaceCallableSql
-
setTimeout
public CallableSql setTimeout(int secs)
Description copied from interface:CallableSql
Set the statement execution timeout. Zero implies unlimited time.This is set to the underlying CallableStatement.
- Specified by:
setTimeout
in interfaceCallableSql
-
setSql
public CallableSql setSql(String sql)
Description copied from interface:CallableSql
Set the callable sql.- Specified by:
setSql
in interfaceCallableSql
-
bind
public CallableSql bind(int position, Object value)
Description copied from interface:CallableSql
Bind a parameter that is bound as a IN parameter.position starts at value 1 (not 0) to be consistent with CallableStatement.
This is designed so that you do not need to set params in index order. You can set/register param 2 before param 1 etc.
- Specified by:
bind
in interfaceCallableSql
- Parameters:
position
- the index position of the parameter.value
- the value of the parameter.
-
setParameter
public CallableSql setParameter(int position, Object value)
Description copied from interface:CallableSql
Bind a positioned parameter (same as bind method).- Specified by:
setParameter
in interfaceCallableSql
- Parameters:
position
- the index position of the parameter.value
- the value of the parameter.
-
registerOut
public CallableSql registerOut(int position, int type)
Description copied from interface:CallableSql
Register an OUT parameter.Note that position starts at value 1 (not 0) to be consistent with CallableStatement.
This is designed so that you do not need to register params in index order. You can set/register param 2 before param 1 etc.
- Specified by:
registerOut
in interfaceCallableSql
- Parameters:
position
- the index position of the parameter (starts with 1).type
- the jdbc type of the OUT parameter that will be read.
-
getObject
public Object getObject(int position)
Description copied from interface:CallableSql
Return an OUT parameter value.position starts at value 1 (not 0) to be consistent with CallableStatement.
This can only be called after the CallableSql has been executed. When run in batch mode you effectively can't use this method.
- Specified by:
getObject
in interfaceCallableSql
-
executeOverride
public boolean executeOverride(CallableStatement cstmt) throws SQLException
Description copied from interface:CallableSql
You can extend this object and override this method for more advanced stored procedure calls. This would be the case when ResultSets are returned etc.- Specified by:
executeOverride
in interfaceCallableSql
- Throws:
SQLException
-
addModification
public CallableSql addModification(String tableName, boolean inserts, boolean updates, boolean deletes)
Description copied from interface:CallableSql
Add table modification information to the TransactionEvent.This would be similar to using the
DB.externalModification()
method. It may be easier and make more sense to set it here with the CallableSql.For UpdateSql the table modification information is derived by parsing the sql to determine the table name and whether it was an insert, update or delete.
- Specified by:
addModification
in interfaceCallableSql
-
getTransactionEventTable
public TransactionEventTable getTransactionEventTable()
Return the TransactionEvent which holds the table modification information for this CallableSql. This information is merged into the transaction after the transaction is commited.- Specified by:
getTransactionEventTable
in interfaceSpiCallableSql
-
getBindParams
public BindParams getBindParams()
- Specified by:
getBindParams
in interfaceSpiCallableSql
-
-