|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujoframework.orm.SqlDialect
public abstract class SqlDialect
SQL dialect abstract class. Methods of this class print a SQL statement(s) along a metamodel usually. You may create a subclass of any implementation to create another SQL statement, however just I can't exclude some small changes of this API in the next release.
| Field Summary | |
|---|---|
static java.lang.String |
COMMON_SEQ_TABLE_KEY
The table key for a common sequence emulator. |
static java.lang.String |
COMMON_SEQ_TABLE_NAME
The table key for a common sequence emulator. |
protected OrmHandler |
ormHandler
The ORM handler |
| Constructor Summary | |
|---|---|
SqlDialect()
|
|
| Method Summary | |
|---|---|
java.sql.Connection |
createConnection(MetaDatabase db)
Create a new database connection |
javax.naming.InitialContext |
createJndiInitialContext(MetaDatabase db)
Get or create an Initial Context for the JNDI lookup. |
protected java.lang.String |
getColumnType(MetaColumn column)
Returns a database column type |
java.lang.String |
getCriterionTemplate(ValueCriterion crit)
Returns an SQL criterion template. |
abstract java.lang.String |
getJdbcDriver()
Returns a JDBC driver class name. |
abstract java.lang.String |
getJdbcUrl()
Returns a default JDBC URL |
java.util.Set<java.lang.String> |
getKeywordSet(java.sql.Connection conn)
Return database SQL keyword set in the upper case. |
protected boolean |
isUsable(java.lang.CharSequence text)
Returns true, if the argument text is not null and not empty. |
java.lang.Appendable |
printAlterTable(MetaColumn column,
java.lang.Appendable out)
Print a SQL sript to add a new column to the table |
java.lang.Appendable |
printCall(MetaProcedure procedure,
java.lang.Appendable out)
Print the call of a stored procedure by template: {? |
java.lang.Appendable |
printColumnAlias(MetaColumn column,
java.lang.Appendable out)
Print a full SQL column alias name by sample: TABLE_ALIAS.COLUMN |
java.lang.Appendable |
printColumnDeclaration(MetaColumn column,
java.lang.String aName,
java.lang.Appendable out)
Print a SQL to create column |
java.lang.Appendable |
printCommit(java.lang.Appendable out)
Print SQL 'COMMIT' |
java.lang.Appendable |
printCreateSchema(java.lang.String schema,
java.lang.Appendable out)
Print SQL 'CREATE SCHEMA' |
ValueCriterion |
printCriterion(ValueCriterion crit,
java.lang.Appendable out)
Print a conditon phrase by the criterion. |
java.lang.Appendable |
printDefaultSchema(java.lang.String schema,
java.lang.Appendable out)
Deprecated. |
java.lang.Appendable |
printDefaultValue(MetaColumn column,
java.lang.Appendable out)
Print a SQL phrase for the DEFAULT VALUE, for example: DEFAULT 777 |
java.lang.Appendable |
printDelete(MetaTable table,
CriterionDecoder decoder,
java.lang.Appendable out)
Print an SQL DELETE statement. |
java.lang.Appendable |
printFKColumnsDeclaration(MetaColumn column,
java.lang.Appendable out)
Print a SQL to create foreign keys. |
java.lang.Appendable |
printForeignKey(MetaColumn column,
MetaTable table,
java.lang.Appendable out)
Print foreign key for the parameter column |
void |
printForeignKey(ValueCriterion crit,
MetaColumn column,
java.lang.String template,
java.lang.Appendable out)
Print all items of the foreign key |
java.lang.Appendable |
printFullTableName(MetaTable table,
java.lang.Appendable out)
Print a full SQL table name by sample: SCHEMA.TABLE |
java.lang.Appendable |
printIndex(MetaIndex index,
java.lang.Appendable out)
Print an INDEX for the parameter column. |
java.lang.Appendable |
printInsert(OrmUjo bo,
java.lang.Appendable out)
Print an SQL INSERT statement. |
void |
println(java.lang.Appendable out)
Print the new line. |
protected java.lang.Appendable |
printLockForSelect(Query query,
java.lang.Appendable out)
Print a 'lock clausule' to the end of SQL SELECT statement to use a pessimistic lock. |
void |
printOffset(Query query,
java.lang.Appendable out)
Print an OFFSET of the statement SELECT. |
java.lang.Appendable |
printSelect(MetaTable table,
Query query,
boolean count,
java.lang.Appendable out)
Print a SQL SELECT by table model and query |
void |
printSelectOrder(Query query,
java.lang.Appendable out)
Print SQL ORDER BY |
protected java.lang.Appendable |
printSelectTable(Query query,
boolean count,
java.lang.Appendable out)
Print SQL database SELECT |
protected java.lang.Appendable |
printSelectView(MetaTable table,
Query query,
boolean count,
java.lang.Appendable out)
Print SQL view SELECT |
java.lang.Appendable |
printSequenceCurrentValue(UjoSequencer sequence,
java.lang.Appendable out)
Print SQL CURRENT SEQUENCE VALUE. |
java.lang.Appendable |
printSequenceInit(UjoSequencer sequence,
java.lang.Appendable out)
Print SQL CREATE SEQUENCE (insert sequence row). |
java.lang.Appendable |
printSequenceNextValue(UjoSequencer sequence,
java.lang.Appendable out)
Print SQL UPDATE NEXT SEQUENCE value. |
java.lang.Appendable |
printSequenceTable(MetaDatabase db,
java.lang.Appendable out)
Print SQL CREATE SEQUENCE. |
protected java.lang.Appendable |
printSequenceTableName(UjoSequencer sequence,
java.lang.Appendable out)
Prinnt the full sequence table |
java.lang.Appendable |
printSetMaxSequence(UjoSequencer sequence,
java.lang.Appendable out)
Set sequence to the max value. |
java.lang.Appendable |
printTable(MetaTable table,
java.lang.Appendable out)
Print a SQL sript to create table |
void |
printTableAliasDefinition(MetaTable table,
java.lang.Appendable out)
Print a SQL database and table name and an alias definition - by sample: SCHEMA.TABLE ALIAS |
void |
printTableColumns(java.util.List<MetaColumn> columns,
java.lang.Appendable values,
java.lang.Appendable out)
Print table columns |
java.lang.Appendable |
printUpdate(MetaTable table,
java.util.List<MetaColumn> changedColumns,
CriterionDecoder decoder,
java.lang.Appendable out)
Print an SQL UPDATE statement. |
void |
setHandler(OrmHandler ormHandler)
Set the OrmHandler - the method is for internal call only. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String COMMON_SEQ_TABLE_NAME
ALTER TABLE ormujo_pk_support RENAME TO ujorm_pk_support;
public static final java.lang.String COMMON_SEQ_TABLE_KEY
protected OrmHandler ormHandler
| Constructor Detail |
|---|
public SqlDialect()
| Method Detail |
|---|
public void setHandler(OrmHandler ormHandler)
public abstract java.lang.String getJdbcUrl()
public abstract java.lang.String getJdbcDriver()
public java.sql.Connection createConnection(MetaDatabase db)
throws java.lang.Exception
java.lang.Exception
public javax.naming.InitialContext createJndiInitialContext(MetaDatabase db)
throws javax.naming.NamingException
javax.naming.NamingException
public java.lang.Appendable printCreateSchema(java.lang.String schema,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
@Deprecated
public java.lang.Appendable printDefaultSchema(java.lang.String schema,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printFullTableName(MetaTable table,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public void printTableAliasDefinition(MetaTable table,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printColumnAlias(MetaColumn column,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printTable(MetaTable table,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printAlterTable(MetaColumn column,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printDefaultValue(MetaColumn column,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printForeignKey(MetaColumn column,
MetaTable table,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printIndex(MetaIndex index,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printColumnDeclaration(MetaColumn column,
java.lang.String aName,
java.lang.Appendable out)
throws java.io.IOException
column - Database ColumnaName - The name parameter is not mandatory, the not null value means a foreign key.
java.io.IOExceptionprotected java.lang.String getColumnType(MetaColumn column)
public java.lang.Appendable printFKColumnsDeclaration(MetaColumn column,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printInsert(OrmUjo bo,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printUpdate(MetaTable table,
java.util.List<MetaColumn> changedColumns,
CriterionDecoder decoder,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printDelete(MetaTable table,
CriterionDecoder decoder,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getCriterionTemplate(ValueCriterion crit)
switch (crit.getOperator()) {
case EQ:
return "{0}={1}";
case NOT_EQ:
return "{0}<>{1}";
case GT:
return "{0}>{1}";
...
public void printTableColumns(java.util.List<MetaColumn> columns,
java.lang.Appendable values,
java.lang.Appendable out)
throws java.io.IOException
columns - List of tablel columnsvalues - Print columns include alias.out - Table columns output.
java.io.IOException
public ValueCriterion printCriterion(ValueCriterion crit,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public void printForeignKey(ValueCriterion crit,
MetaColumn column,
java.lang.String template,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSelect(MetaTable table,
Query query,
boolean count,
java.lang.Appendable out)
throws java.io.IOException
query - The UJO querycount - only count of items is required;
java.io.IOException
protected java.lang.Appendable printSelectView(MetaTable table,
Query query,
boolean count,
java.lang.Appendable out)
throws java.io.IOException
query - The UJO querycount - only count of items is required;
java.io.IOException
protected java.lang.Appendable printSelectTable(Query query,
boolean count,
java.lang.Appendable out)
throws java.io.IOException
query - The UJO querycount - only count of items is required;
java.io.IOException
protected java.lang.Appendable printLockForSelect(Query query,
java.lang.Appendable out)
throws java.io.IOException,
java.lang.UnsupportedOperationException
query - The UJO query
java.io.IOException
java.lang.UnsupportedOperationException
public void printSelectOrder(Query query,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printCall(MetaProcedure procedure,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public void printOffset(Query query,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
protected java.lang.Appendable printSequenceTableName(UjoSequencer sequence,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSequenceTable(MetaDatabase db,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSequenceInit(UjoSequencer sequence,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSequenceNextValue(UjoSequencer sequence,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSetMaxSequence(UjoSequencer sequence,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printSequenceCurrentValue(UjoSequencer sequence,
java.lang.Appendable out)
throws java.io.IOException
java.io.IOExceptionprotected boolean isUsable(java.lang.CharSequence text)
public final void println(java.lang.Appendable out)
throws java.io.IOException
java.io.IOException
public java.lang.Appendable printCommit(java.lang.Appendable out)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Set<java.lang.String> getKeywordSet(java.sql.Connection conn)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||