org.dbflute.cbean.sqlclause.SqlClauseFirebird Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dbflute-runtime Show documentation
Show all versions of dbflute-runtime Show documentation
The runtime library of DBFlute
/*
* Copyright 2014-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.dbflute.cbean.sqlclause;
import org.dbflute.dbway.DBDef;
import org.dbflute.dbway.DBWay;
/**
* SqlClause for Firebird.
* @author jflute
*/
public class SqlClauseFirebird extends AbstractSqlClause {
// ===================================================================================
// Definition
// ==========
/** The serial version UID for object serialization. (Default) */
private static final long serialVersionUID = 1L;
// ===================================================================================
// Attribute
// =========
/** String of fetch-scope as select-hint. */
protected String _fetchScopeSelectHint = "";
/** String of lock as sql-suffix. */
protected String _lockSqlSuffix = "";
// ===================================================================================
// Constructor
// ===========
/**
* Constructor.
* @param tableDbName The DB name of table. (NotNull)
**/
public SqlClauseFirebird(String tableDbName) {
super(tableDbName);
}
// ===================================================================================
// FetchScope Override
// ===================
/**
* {@inheritDoc}
*/
protected void doFetchFirst() {
if (isFetchSizeSupported()) {
_fetchScopeSelectHint = " first " + getFetchSize();
}
}
/**
* {@inheritDoc}
*/
protected void doFetchPage() {
if (isFetchStartIndexSupported() && isFetchSizeSupported()) {
_fetchScopeSelectHint = " first " + getFetchSize() + " skip " + getPageStartIndex();
}
if (isFetchStartIndexSupported() && !isFetchSizeSupported()) {
_fetchScopeSelectHint = " skip " + getPageStartIndex();
}
if (!isFetchStartIndexSupported() && isFetchSizeSupported()) {
_fetchScopeSelectHint = " first " + getPageEndIndex();
}
}
/**
* {@inheritDoc}
*/
protected void doClearFetchPageClause() {
_fetchScopeSelectHint = "";
}
// ===================================================================================
// Lock Override
// =============
/**
* {@inheritDoc}
*/
public void lockForUpdate() {
_lockSqlSuffix = " for update with lock";
}
// ===================================================================================
// Hint Override
// =============
/**
* {@inheritDoc}
*/
protected String createSelectHint() {
return _fetchScopeSelectHint;
}
/**
* {@inheritDoc}
*/
protected String createFromBaseTableHint() {
return "";
}
/**
* {@inheritDoc}
*/
protected String createFromHint() {
return "";
}
/**
* {@inheritDoc}
*/
protected String createSqlSuffix() {
return _lockSqlSuffix;
}
// [DBFlute-0.9.8.4]
// ===================================================================================
// DBWay
// =====
public DBWay dbway() {
return DBDef.Firebird.dbway();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy