public class AnsiDialect extends Object implements SqlDialect
Modifier and Type | Field and Description |
---|---|
protected String |
name |
static Pattern |
patternORDER_BY |
Constructor and Description |
---|
AnsiDialect() |
Modifier and Type | Method and Description |
---|---|
SqlFeature |
addFeature(SqlFeature sqlFeature)
Override a SQL ANSI feature
|
String |
buildQueryCount(String sqlText)
Build a paginate query to count the total of records from
sqlText |
String |
buildQueryPaging(String sqlText,
int offset,
int max)
Build a paginate query accordingly data base dialect
|
String |
buildQueryPaging(String sqlText,
int offset,
int max,
String bookmark)
Build a paginate query accordingly data base dialect
|
protected int |
countOccurrencesOf(String str,
String sub)
Count the occurrences of the substring in string s.
|
PropertyAccess |
getAccessId()
The access name for
id field, the identifier from an entity |
PropertyAccess |
getAccessRevision()
The access name for
revision field, a revision number from an entity |
int |
getMaxOfParameters()
Return the limit of elements in an
INPUT parameter the database supports. |
String |
getSqlPatternCount()
The template to mount the
COUNT SQL |
String |
getSqlPatternPaging()
The template to mount the SQL paginated, using LIMIT and OFFSET
clauses according the specific database
|
String |
name()
Dialect name
|
void |
setMaxOfParameters(int max)
Max number of parameters supported by JDBC driver
|
protected Matcher |
sqlEndsWithOrderBy(String sql) |
protected Matcher |
sqlEndWithForUpdate(String sql) |
protected Matcher |
sqlStartWithSelect(String sql) |
protected Matcher |
sqlStartWithSelectOrDistinct(String sql) |
boolean |
supportsFeature(SqlFeatureSupport feature)
verify if dialect instance supports
feature specified |
boolean |
supportsParmMark(ParamMarkType paramParse)
verify if dialect supports a specific
ParamMarkType |
public static final Pattern patternORDER_BY
public AnsiDialect()
public String name()
SqlDialect
name
in interface SqlDialect
public boolean supportsFeature(SqlFeatureSupport feature)
SqlDialect
feature
specifiedsupportsFeature
in interface SqlDialect
feature
- to checktrue
when the dialect supports, false
otherwisepublic boolean supportsParmMark(ParamMarkType paramParse)
SqlDialect
ParamMarkType
supportsParmMark
in interface SqlDialect
paramParse
- parameter mark typetrue
when the parse type is supported, false
otherwisepublic SqlFeature addFeature(SqlFeature sqlFeature)
SqlDialect
addFeature
in interface SqlDialect
sqlFeature
- override a SqlFeature
supports.sqlFeature
public int getMaxOfParameters()
SqlDialect
INPUT
parameter the database supports.getMaxOfParameters
in interface SqlDialect
Integer.MAX_VALUE
public void setMaxOfParameters(int max)
SqlDialect
setMaxOfParameters
in interface SqlDialect
max
- maximum value of parameter in the querypublic String getSqlPatternCount()
SqlDialect
COUNT
SQLgetSqlPatternCount
in interface SqlDialect
select count(1) from (%1$s) _alias_internal_table_
public String getSqlPatternPaging()
SqlDialect
getSqlPatternPaging
in interface SqlDialect
%1$s LIMIT %2$s, %3$s
public String buildQueryPaging(String sqlText, int offset, int max)
SqlDialect
buildQueryPaging
in interface SqlDialect
sqlText
- final SQL with parameters to bindoffset
- number from first row from query resultmax
- maximum number of rows from query result.public String buildQueryPaging(String sqlText, int offset, int max, String bookmark)
SqlDialect
buildQueryPaging
in interface SqlDialect
sqlText
- final SQL with parameters to bindoffset
- number from first row from query resultmax
- maximum number of rows from query result.bookmark
- a page selected marked the reader's placepublic PropertyAccess getAccessId()
SqlDialect
id
field, the identifier from an entitygetAccessId
in interface SqlDialect
id
, getId
, setId
public PropertyAccess getAccessRevision()
SqlDialect
revision
field, a revision number from an entitygetAccessRevision
in interface SqlDialect
rev
, getRev
, setRev
public String buildQueryCount(String sqlText)
SqlDialect
sqlText
buildQueryCount
in interface SqlDialect
sqlText
- original SQL to discover the total of recordssqlText
protected Matcher sqlStartWithSelect(String sql)
protected Matcher sqlStartWithSelectOrDistinct(String sql)
protected Matcher sqlEndsWithOrderBy(String sql)
protected Matcher sqlEndWithForUpdate(String sql)
protected int countOccurrencesOf(String str, String sub)
str
- string to search in. Return 0 if this is null.sub
- string to search for. Return 0 if this is null.str
Copyright © 2012–2020 jkniv, copyleft code. All rights reserved.