Interface ISqlDialect<SELECT extends SelectBuilder,INSERT extends InsertBuilder,UPDATE extends UpdateBuilder,DELETE extends DeleteBuilder,CREATE extends CreateBranchingBuilder,ALTER extends AlterBranchingBuilder,DROP extends DropBranchingBuilder,NEXT extends NextValueSequenceBuilder,LAST extends LastValueIdentityBuilder>
- Type Parameters:
SELECT- the generic typeINSERT- the generic typeUPDATE- the generic typeDELETE- the generic typeCREATE- the generic typeALTER- the generic typeDROP- the generic typeNEXT- the generic type
- All Superinterfaces:
ISqlFactory<SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER,DROP,NEXT,LAST>,ISqlKeywords
- All Known Implementing Classes:
DefaultSqlDialect,DerbySqlDialect,H2SqlDialect,HanaSqlDialect,MySQLSqlDialect,PostgresSqlDialect,SybaseSqlDialect
public interface ISqlDialect<SELECT extends SelectBuilder,INSERT extends InsertBuilder,UPDATE extends UpdateBuilder,DELETE extends DeleteBuilder,CREATE extends CreateBranchingBuilder,ALTER extends AlterBranchingBuilder,DROP extends DropBranchingBuilder,NEXT extends NextValueSequenceBuilder,LAST extends LastValueIdentityBuilder> extends ISqlFactory<SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER,DROP,NEXT,LAST>, ISqlKeywords
The SQL Dialect interface.
-
Field Summary
Fields inherited from interface org.eclipse.dirigible.database.sql.ISqlKeywords
ALTER, CLOSE, COMMA, EQUALS, FUNCTION_CURRENT_DATE, FUNCTION_CURRENT_TIME, FUNCTION_CURRENT_TIMESTAMP, KEYWORD_ADD, KEYWORD_ALTER, KEYWORD_AND, KEYWORD_AS, KEYWORD_ASC, KEYWORD_CHECK, KEYWORD_COLUMN, KEYWORD_CONSTRAINT, KEYWORD_CREATE, KEYWORD_DATABASE_DROP_RESTRICT, KEYWORD_DELETE, KEYWORD_DESC, KEYWORD_DISTINCT, KEYWORD_DROP, KEYWORD_FETCH, KEYWORD_FOR, KEYWORD_FOR_UPDATE, KEYWORD_FOREIGN, KEYWORD_FROM, KEYWORD_FULL, KEYWORD_GROUP_BY, KEYWORD_HAVING, KEYWORD_IDENTITY, KEYWORD_INDEX, KEYWORD_INNER, KEYWORD_INSERT, KEYWORD_INTO, KEYWORD_JOIN, KEYWORD_KEY, KEYWORD_LEFT, KEYWORD_LIMIT, KEYWORD_NEXT, KEYWORD_NEXT_VALUE_FOR, KEYWORD_NOT, KEYWORD_NULL, KEYWORD_OFFSET, KEYWORD_ON, KEYWORD_ONLY, KEYWORD_OR, KEYWORD_ORDER_BY, KEYWORD_OUTER, KEYWORD_PRIMARY, KEYWORD_PUBLIC, KEYWORD_REFERENCES, KEYWORD_RIGHT, KEYWORD_ROWS, KEYWORD_SELECT, KEYWORD_SEQUENCE, KEYWORD_SEQUENCE_CYCLE, KEYWORD_SEQUENCE_EMPTY_STRING_FOR_BOOLEAN_TYPES, KEYWORD_SEQUENCE_INCREMENT_BY, KEYWORD_SEQUENCE_MAXVALUE, KEYWORD_SEQUENCE_MINVALUE, KEYWORD_SEQUENCE_NO_MAXVALUE, KEYWORD_SEQUENCE_NO_MINVALUE, KEYWORD_SEQUENCE_RESET_BY, KEYWORD_SEQUENCE_RESTART_WITH, KEYWORD_SEQUENCE_START_WITH, KEYWORD_SET, KEYWORD_START, KEYWORD_SYNONYM, KEYWORD_TABLE, KEYWORD_UNION, KEYWORD_UNIQUE, KEYWORD_UPDATE, KEYWORD_VALUES, KEYWORD_VIEW, KEYWORD_WHERE, KEYWORD_WITH, METADATA_ALIAS, METADATA_CALC_VIEW, METADATA_GLOBAL_TEMPORARY, METADATA_LOCAL_TEMPORARY, METADATA_SYNONYM, METADATA_SYSTEM_TABLE, METADATA_TABLE, METADATA_TABLE_TYPES, METADATA_VIEW, OPEN, QUESTION, SPACE, STAR, TABLE, UNDERSCROE -
Method Summary
Modifier and Type Method Description intcount(Connection connection, String table)Returns the count of rows in the given table.booleanexists(Connection connection, String table)Check existence of a table.booleanexists(Connection connection, String name, int type)Check existence of an artifacts.StringfunctionCurrentDate()Gives the dialect specific name of the CURRENT_DATE function.StringfunctionCurrentTime()Gives the dialect specific name of the CURRENT_TIME function.StringfunctionCurrentTimestamp()Gives the dialect specific name of the CURRENT_TIMESTAMP function.StringgetDatabaseName(Connection connection)Returns the database nameStringgetDataTypeName(DataType dataType)Default implementation returns the direct toString() conversion.Set<String>getFunctionsNames()Returns the function namesStringgetIdentityArgument()Identity argument for a column for the create table script Default is "IDENTITY".StringgetNotNullArgument()NOT NULL argument for a column for the create table script Default is "NOT NULL".StringgetPrimaryKeyArgument()PRIMARY KEY argument for a column for the create table script Default is "PRIMARY KEY".StringgetSchemaFilterScript()If the database supports schema filtering SQL statements (seeisSchemaFilterSupported()), this method provides the corresponding SQL statement.StringgetUniqueArgument()UNIQUE argument for a column for the create table script Default is "UNIQUE".booleanisCatalogForSchema()Does this database support catalogs synonymous to schemas.booleanisSchemaFilterSupported()Checks if the database is capable of schema-level filtering statements (e.g.booleanisSequenceSupported()Checks if the database is capable to create and use Sequences.booleanisSynonymSupported()Checks if the database is capable to create and use Synonyms.
-
Field Details
-
Method Details
-
getDataTypeName
Default implementation returns the direct toString() conversion. It may get overridden for specific database dialects- Parameters:
dataType- the data type- Returns:
- the data type name
-
getPrimaryKeyArgument
String getPrimaryKeyArgument()PRIMARY KEY argument for a column for the create table script Default is "PRIMARY KEY".- Returns:
- the primary key argument
-
getIdentityArgument
String getIdentityArgument()Identity argument for a column for the create table script Default is "IDENTITY".- Returns:
- the primary key argument
-
getNotNullArgument
String getNotNullArgument()NOT NULL argument for a column for the create table script Default is "NOT NULL".- Returns:
- the not null argument
-
getUniqueArgument
String getUniqueArgument()UNIQUE argument for a column for the create table script Default is "UNIQUE".- Returns:
- the unique argument
-
exists
Check existence of a table.- Specified by:
existsin interfaceISqlFactory<SELECT extends SelectBuilder,INSERT extends InsertBuilder,UPDATE extends UpdateBuilder,DELETE extends DeleteBuilder,CREATE extends CreateBranchingBuilder,ALTER extends AlterBranchingBuilder,DROP extends DropBranchingBuilder,NEXT extends NextValueSequenceBuilder,LAST extends LastValueIdentityBuilder>- Parameters:
connection- the current connectiontable- the table name- Returns:
- true if the table exists and false otherwise
- Throws:
SQLException- the SQL exception
-
exists
Check existence of an artifacts.- Specified by:
existsin interfaceISqlFactory<SELECT extends SelectBuilder,INSERT extends InsertBuilder,UPDATE extends UpdateBuilder,DELETE extends DeleteBuilder,CREATE extends CreateBranchingBuilder,ALTER extends AlterBranchingBuilder,DROP extends DropBranchingBuilder,NEXT extends NextValueSequenceBuilder,LAST extends LastValueIdentityBuilder>- Parameters:
connection- the current connectionname- the artifact nametype- the artifact type- Returns:
- true if the table exists and false otherwise
- Throws:
SQLException- the SQL exception
-
count
Returns the count of rows in the given table.- Specified by:
countin interfaceISqlFactory<SELECT extends SelectBuilder,INSERT extends InsertBuilder,UPDATE extends UpdateBuilder,DELETE extends DeleteBuilder,CREATE extends CreateBranchingBuilder,ALTER extends AlterBranchingBuilder,DROP extends DropBranchingBuilder,NEXT extends NextValueSequenceBuilder,LAST extends LastValueIdentityBuilder>- Parameters:
connection- the current connectiontable- the table name- Returns:
- count of rows
- Throws:
SQLException- the SQL exception
-
isSchemaFilterSupported
boolean isSchemaFilterSupported()Checks if the database is capable of schema-level filtering statements (e.g. to reduce the provisioned schemas down to those that the current user is entitled to see).- Returns:
- true if the feature is supported , false otherwise
-
getSchemaFilterScript
String getSchemaFilterScript()If the database supports schema filtering SQL statements (seeisSchemaFilterSupported()), this method provides the corresponding SQL statement.- Returns:
- a filtering SQL statement
-
isCatalogForSchema
boolean isCatalogForSchema()Does this database support catalogs synonymous to schemas.- Returns:
- whether it is a catalog for schema
-
functionCurrentDate
String functionCurrentDate()Gives the dialect specific name of the CURRENT_DATE function.- Returns:
- the name of the function
-
functionCurrentTime
String functionCurrentTime()Gives the dialect specific name of the CURRENT_TIME function.- Returns:
- the name of the function
-
functionCurrentTimestamp
String functionCurrentTimestamp()Gives the dialect specific name of the CURRENT_TIMESTAMP function.- Returns:
- the name of the function
-
isSequenceSupported
boolean isSequenceSupported()Checks if the database is capable to create and use Sequences.- Returns:
- true if the feature is supported, false otherwise
-
getDatabaseName
Returns the database name- Parameters:
connection- the active database connection- Returns:
- the database name
-
isSynonymSupported
boolean isSynonymSupported()Checks if the database is capable to create and use Synonyms.- Returns:
- true if the feature is supported, false otherwise
-
getFunctionsNames
Returns the function names- Returns:
- the list of functions names
-