public class DefaultCallableSql extends Object implements Serializable, SpiCallableSql
| Constructor and Description |
|---|
DefaultCallableSql(EbeanServer server,
String sql)
Create with callable sql.
|
| Modifier and Type | Method and 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.
|
public DefaultCallableSql(EbeanServer server, String sql)
public void execute()
public String getLabel()
CallableSqlgetLabel in interface CallableSqlpublic CallableSql setLabel(String label)
CallableSqlsetLabel in interface CallableSqlpublic int getTimeout()
CallableSqlgetTimeout in interface CallableSqlpublic String getSql()
CallableSqlgetSql in interface CallableSqlpublic CallableSql setTimeout(int secs)
CallableSqlThis is set to the underlying CallableStatement.
setTimeout in interface CallableSqlpublic CallableSql setSql(String sql)
CallableSqlsetSql in interface CallableSqlpublic CallableSql bind(int position, Object value)
CallableSqlposition 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.
bind in interface CallableSqlposition - the index position of the parameter.value - the value of the parameter.public CallableSql setParameter(int position, Object value)
CallableSqlsetParameter in interface CallableSqlposition - the index position of the parameter.value - the value of the parameter.public CallableSql registerOut(int position, int type)
CallableSqlNote 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.
registerOut in interface CallableSqlposition - the index position of the parameter (starts with 1).type - the jdbc type of the OUT parameter that will be read.public Object getObject(int position)
CallableSqlposition 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.
getObject in interface CallableSqlpublic boolean executeOverride(CallableStatement cstmt) throws SQLException
CallableSqlexecuteOverride in interface CallableSqlSQLExceptionpublic CallableSql addModification(String tableName, boolean inserts, boolean updates, boolean deletes)
CallableSql
This would be similar to using the
Ebean.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.
addModification in interface CallableSqlpublic TransactionEventTable getTransactionEventTable()
getTransactionEventTable in interface SpiCallableSqlpublic BindParams getBindParams()
getBindParams in interface SpiCallableSqlCopyright © 2014. All Rights Reserved.