Package net.sf.jkniv.sqlegance.dialect
Interface SqlDialect
-
- All Known Implementing Classes:
AnsiDialect
public interface SqlDialectRepresents a SQL syntax from a specific database. The implementations provider correct syntax to execute a paging query, that limits the number of rows returned and SQL to count of total records.Note: The implementation MUST BE state-less and thread-safe because one instance parse all queries from one
Repository.- Since:
- 0.6.0
- Author:
- Alisson Gomes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SqlFeatureaddFeature(SqlFeature sqlFeature)Override a SQL ANSI featureStringbuildQueryCount(String sqlText)Build a paginate query to count the total of records fromsqlTextStringbuildQueryPaging(String sqlText, int offset, int max)Build a paginate query accordingly data base dialectStringbuildQueryPaging(String sqlText, int offset, int max, String bookmark)Build a paginate query accordingly data base dialectnet.sf.jkniv.reflect.beans.PropertyAccessgetAccessId()The access name foridfield, the identifier from an entitynet.sf.jkniv.reflect.beans.PropertyAccessgetAccessRevision()The access name forrevisionfield, a revision number from an entityintgetMaxOfParameters()Return the limit of elements in anINPUTparameter the database supports.StringgetSqlPatternCount()The template to mount theCOUNTSQLStringgetSqlPatternPaging()The template to mount the SQL paginated, using LIMIT and OFFSET clauses according the specific databaseStringname()Dialect namevoidsetMaxOfParameters(int max)Max number of parameters supported by JDBC driverbooleansupportsFeature(SqlFeatureSupport feature)verify if dialect instance supportsfeaturespecifiedbooleansupportsParmMark(ParamMarkType paramParse)verify if dialect supports a specificParamMarkType
-
-
-
Method Detail
-
name
String name()
Dialect name- Returns:
- the dialect name
-
supportsFeature
boolean supportsFeature(SqlFeatureSupport feature)
verify if dialect instance supportsfeaturespecified- Parameters:
feature- to check- Returns:
truewhen the dialect supports,falseotherwise
-
supportsParmMark
boolean supportsParmMark(ParamMarkType paramParse)
verify if dialect supports a specificParamMarkType- Parameters:
paramParse- parameter mark type- Returns:
truewhen the parse type is supported,falseotherwise
-
addFeature
SqlFeature addFeature(SqlFeature sqlFeature)
Override a SQL ANSI feature- Parameters:
sqlFeature- override aSqlFeaturesupports.- Returns:
- the previous value associated with key
sqlFeature
-
getMaxOfParameters
int getMaxOfParameters()
Return the limit of elements in anINPUTparameter the database supports.- Returns:
- the limit of parameters from statement, default is a big number
Integer.MAX_VALUE
-
setMaxOfParameters
void setMaxOfParameters(int max)
Max number of parameters supported by JDBC driver- Parameters:
max- maximum value of parameter in the query
-
getSqlPatternCount
String getSqlPatternCount()
The template to mount theCOUNTSQL- Returns:
- a string template, like that:
select count(1) from (%1$s) _alias_internal_table_
-
getSqlPatternPaging
String getSqlPatternPaging()
The template to mount the SQL paginated, using LIMIT and OFFSET clauses according the specific database- Returns:
- a string template, like that:
%1$s LIMIT %2$s, %3$s
-
buildQueryPaging
String buildQueryPaging(String sqlText, int offset, int max)
Build a paginate query accordingly data base dialect- Parameters:
sqlText- final SQL with parameters to bindoffset- number from first row from query resultmax- maximum number of rows from query result.- Returns:
- paginate query for specific data base dialect
-
buildQueryPaging
String buildQueryPaging(String sqlText, int offset, int max, String bookmark)
Build a paginate query accordingly data base dialect- Parameters:
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 place- Returns:
- paginate query for specific data base dialect
-
buildQueryCount
String buildQueryCount(String sqlText)
Build a paginate query to count the total of records fromsqlText- Parameters:
sqlText- original SQL to discover the total of records- Returns:
- query that count the total of records from
sqlText
-
getAccessId
net.sf.jkniv.reflect.beans.PropertyAccess getAccessId()
The access name foridfield, the identifier from an entity- Returns:
- the property access, default access values are:
id,getId,setId
-
getAccessRevision
net.sf.jkniv.reflect.beans.PropertyAccess getAccessRevision()
The access name forrevisionfield, a revision number from an entity- Returns:
- the property access, default access values are:
rev,getRev,setRev
-
-