Search in sources :

Example 1 with FetchNarrowingBean

use of org.dbflute.cbean.paging.FetchNarrowingBean in project dbflute-core by dbflute.

the class TnBasicSelectHandler method isUseFunctionalResultSet.

protected boolean isUseFunctionalResultSet() {
    // for safety result
    final FetchBean fcbean = FetchAssistContext.getFetchBeanOnThread();
    if (fcbean != null && fcbean.getSafetyMaxResultSize() > 0) {
        // priority one
        return true;
    }
    final FetchNarrowingBean fnbean = FetchAssistContext.getFetchNarrowingBeanOnThread();
    if (fnbean != null && fnbean.isFetchNarrowingEffective()) {
        // for unsupported paging (ConditionBean)
        if (fnbean.isFetchNarrowingSkipStartIndexEffective() || fnbean.isFetchNarrowingLoopCountEffective()) {
            // priority two
            return true;
        }
        // for auto paging (OutsideSql)
        if (OutsideSqlContext.isExistOutsideSqlContextOnThread()) {
            final OutsideSqlContext outsideSqlContext = OutsideSqlContext.getOutsideSqlContextOnThread();
            if (outsideSqlContext.isOffsetByCursorForcedly() || outsideSqlContext.isLimitByCursorForcedly()) {
                // priority three
                return true;
            }
        }
    }
    return false;
}
Also used : FetchBean(org.dbflute.jdbc.FetchBean) OutsideSqlContext(org.dbflute.outsidesql.OutsideSqlContext) FetchNarrowingBean(org.dbflute.cbean.paging.FetchNarrowingBean)

Example 2 with FetchNarrowingBean

use of org.dbflute.cbean.paging.FetchNarrowingBean in project dbflute-core by dbflute.

the class BehaviorCommandInvoker method closeContext.

protected void closeContext() {
    if (FetchAssistContext.isExistFetchNarrowingBeanOnThread()) {
        // /- - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // Because there is possible that fetch narrowing has been
        // ignored for manualPaging of outsideSql.
        // - - - - - - - - - -/
        final FetchNarrowingBean fnbean = FetchAssistContext.getFetchNarrowingBeanOnThread();
        fnbean.xenableIgnoredFetchNarrowing();
    }
    clearAllCurrentContext();
    restoreAllContextOnThreadIfExists();
}
Also used : FetchNarrowingBean(org.dbflute.cbean.paging.FetchNarrowingBean)

Aggregations

FetchNarrowingBean (org.dbflute.cbean.paging.FetchNarrowingBean)2 FetchBean (org.dbflute.jdbc.FetchBean)1 OutsideSqlContext (org.dbflute.outsidesql.OutsideSqlContext)1