BEHAVIOR - The type of behavior.public class OutsideSqlBasicExecutor<BEHAVIOR> extends Object
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected BehaviorCommandInvoker |
_behaviorCommandInvoker
The invoker of behavior command.
|
protected DBDef |
_currentDBDef
The current database definition.
|
protected OutsideSqlContextFactory |
_outsideSqlContextFactory
The factory of outside-SQL context.
|
protected OutsideSqlExecutorFactory |
_outsideSqlExecutorFactory
The factory of outside-SQL executor.
|
protected OutsideSqlFilter |
_outsideSqlFilter
The filter of outside-SQL.
|
protected OutsideSqlOption |
_outsideSqlOption
The option of outside-SQL.
|
protected String |
_tableDbName
Table DB name.
|
| コンストラクタと説明 |
|---|
OutsideSqlBasicExecutor(BehaviorCommandInvoker behaviorCommandInvoker,
String tableDbName,
DBDef currentDBDef,
OutsideSqlOption outsideSqlOption,
OutsideSqlContextFactory outsideSqlContextFactory,
OutsideSqlFilter outsideSqlFilter,
OutsideSqlExecutorFactory outsideSqlExecutorFactory) |
protected final BehaviorCommandInvoker _behaviorCommandInvoker
protected final String _tableDbName
protected final DBDef _currentDBDef
protected final OutsideSqlOption _outsideSqlOption
protected final OutsideSqlContextFactory _outsideSqlContextFactory
protected final OutsideSqlFilter _outsideSqlFilter
protected final OutsideSqlExecutorFactory _outsideSqlExecutorFactory
public OutsideSqlBasicExecutor(BehaviorCommandInvoker behaviorCommandInvoker, String tableDbName, DBDef currentDBDef, OutsideSqlOption outsideSqlOption, OutsideSqlContextFactory outsideSqlContextFactory, OutsideSqlFilter outsideSqlFilter, OutsideSqlExecutorFactory outsideSqlExecutorFactory)
public <ENTITY> ListResultBean<ENTITY> selectList(ListHandlingPmb<BEHAVIOR,ENTITY> pmb)
SimpleMemberPmb pmb = new SimpleMemberPmb();
pmb.setMemberName_PrefixSearch("S");
ListResultBean<SimpleMember> memberList
= memberBhv.outsideSql().selectList(pmb);
for (SimpleMember member : memberList) {
... = member.get...();
}
It needs to use customize-entity and parameter-bean.
The way to generate them is following:
-- #df:entity# -- !df:pmb! -- !!Integer memberId!! -- !!String memberName!! -- !!...!!
ENTITY - The type of entity for element.pmb - The typed parameter-bean for list handling. (NotNull)OutsideSqlNotFoundException - When the outsideSql is not found.DangerousResultSizeException - When the result size is over the specified safety size.public <ENTITY> ListResultBean<ENTITY> selectList(String path, Object pmb, Class<ENTITY> entityType)
String path = MemberBhv.PATH_selectSimpleMember;
SimpleMemberPmb pmb = new SimpleMemberPmb();
pmb.setMemberName_PrefixSearch("S");
Class<SimpleMember> entityType = SimpleMember.class;
ListResultBean<SimpleMember> memberList
= memberBhv.outsideSql().selectList(path, pmb, entityType);
for (SimpleMember member : memberList) {
... = member.get...();
}
It needs to use customize-entity and parameter-bean.
The way to generate them is following:
-- #df:entity# -- !df:pmb! -- !!Integer memberId!! -- !!String memberName!! -- !!...!!
ENTITY - The type of entity for element.path - The path of SQL file. (NotNull)pmb - The object as parameter-bean. Allowed types are Bean object and Map object. (NullAllowed)entityType - The element type of entity. (NotNull)OutsideSqlNotFoundException - When the outsideSql is not found.DangerousResultSizeException - When the result size is over the specified safety size.protected <ENTITY> ListResultBean<ENTITY> doSelectList(String path, Object pmb, Class<ENTITY> entityType)
protected <ENTITY> ListResultBean<ENTITY> createListResultBean(List<ENTITY> selectedList)
protected void throwDangerousResultSizeException(Object pmb, FetchingOverSafetySizeException e)
public int execute(ExecuteHandlingPmb<BEHAVIOR> pmb)
SimpleMemberPmb pmb = new SimpleMemberPmb();
pmb.setMemberId(3);
int count = memberBhv.outsideSql().execute(pmb);
pmb - The parameter-bean. Allowed types are Bean object and Map object. (NullAllowed)OutsideSqlNotFoundException - When the outsideSql is not found.public int execute(String path, Object pmb)
String path = MemberBhv.PATH_selectSimpleMember;
SimpleMemberPmb pmb = new SimpleMemberPmb();
pmb.setMemberId(3);
int count = memberBhv.outsideSql().execute(path, pmb);
path - The path of SQL file. (NotNull)pmb - The parameter-bean. Allowed types are Bean object and Map object. (NullAllowed)OutsideSqlNotFoundException - When the outsideSql is not found.public void call(ProcedurePmb pmb)
SpInOutParameterPmb pmb = new SpInOutParameterPmb();
pmb.setVInVarchar("foo");
pmb.setVInOutVarchar("bar");
memberBhv.outsideSql().call(pmb);
String outVar = pmb.getVOutVarchar();
It needs to use parameter-bean for procedure (ProcedurePmb).
The way to generate is to set the option of DBFlute property and execute Sql2Entity.pmb - The parameter-bean for procedure. (NotNull)protected <ENTITY> BehaviorCommand<List<ENTITY>> createSelectListCommand(String path, Object pmb, Class<ENTITY> entityType)
protected <ENTITY> OutsideSqlSelectListCommand<ENTITY> newOutsideSqlSelectListCommand()
protected BehaviorCommand<Integer> createExecuteCommand(String path, Object pmb)
protected OutsideSqlExecuteCommand newOutsideSqlExecuteCommand()
protected BehaviorCommand<Void> createCallCommand(String path, Object pmb)
protected OutsideSqlCallCommand newOutsideSqlCallCommand()
protected <COMMAND extends AbstractOutsideSqlCommand<?>> COMMAND xsetupCommand(COMMAND cmd, String path, Object pmb)
protected <RESULT> RESULT invoke(BehaviorCommand<RESULT> behaviorCommand)
RESULT - The type of result.behaviorCommand - The command of behavior. (NotNull)public OutsideSqlEntityExecutor<BEHAVIOR> entityHandling()
memberBhv.outsideSql().entityHandling().selectEntityWithDeletedCheck(pmb);
protected OutsideSqlEntityExecutor<BEHAVIOR> createOutsideSqlEntityExecutor()
public OutsideSqlManualPagingExecutor<BEHAVIOR> manualPaging()
memberBhv.outsideSql().manualPaging().selectPage(pmb);
If you call this, you need to write paging condition on your SQL.
e.g. MySQL
select member.MEMBER_ID, member...
from Member member
where ...
order by ...
limit 40, 20 -- is necessary!
protected OutsideSqlManualPagingExecutor<BEHAVIOR> createOutsideSqlManualPagingExecutor()
public OutsideSqlAutoPagingExecutor<BEHAVIOR> autoPaging()
memberBhv.outsideSql().autoPaging().selectPage(pmb);
If you call this, you don't need to write paging condition on your SQL.
e.g. MySQL
select member.MEMBER_ID, member...
from Member member
where ...
order by ...
-- limit 40, 20 -- is unnecessary!
protected OutsideSqlAutoPagingExecutor<BEHAVIOR> createOutsideSqlAutoPagingExecutor()
public OutsideSqlCursorExecutor<BEHAVIOR> cursorHandling()
memberBhv.outsideSql().cursorHandling().selectCursor(pmb);
protected OutsideSqlCursorExecutor<BEHAVIOR> createOutsideSqlCursorExecutor()
public OutsideSqlBasicExecutor<BEHAVIOR> removeBlockComment()
public OutsideSqlBasicExecutor<BEHAVIOR> removeLineComment()
public OutsideSqlBasicExecutor<BEHAVIOR> formatSql()
public OutsideSqlBasicExecutor<BEHAVIOR> configure(StatementConfig statementConfig)
statementConfig - The configuration of statement. (NotNull)public BehaviorExceptionThrower createBhvExThrower()
protected <ENTITY> void assertTypedPmbNotNull(TypedParameterBean<BEHAVIOR> pmb)
public OutsideSqlOption getOutsideSqlOption()
Copyright © 2014–2015 The DBFlute Project. All rights reserved.