org.ujorm.orm.dialect
Class MySqlDialect

java.lang.Object
  extended by org.ujorm.orm.SqlDialect
      extended by org.ujorm.orm.dialect.MySqlDialect

public class MySqlDialect
extends SqlDialect

Dialect for the MySQL since release 5.0 for the InnoDB engine.
http://dev.mysql.com/


Field Summary
 
Fields inherited from class org.ujorm.orm.SqlDialect
COMMON_SEQ_TABLE_KEY, DEFAULT_SCHEMA_SYMBOL, ormHandler
 
Constructor Summary
MySqlDialect()
           
 
Method Summary
protected  String getColumnType(MetaColumn column)
          MySQL dialect uses a database type DATETIME (instead of the TIMESTAMP) for the java.util.Date.
protected  String getEngine(MetaTable table)
          Returns a MySQL enginge.
 String getJdbcDriver()
          Returns a JDBC driver class name.
 String getJdbcUrl()
          Returns a default JDBC URL
 Appendable printComment(MetaColumn column, Appendable out)
          Important note for MySQL: the change of column modifies all another column attributes so the comment update can revert some hand-made changes different from meta-model.
 Appendable printComment(MetaTable table, Appendable out)
          Print a Comment on the table
 Appendable printDelete(MetaTable table, CriterionDecoder decoder, Appendable out)
          Print an SQL DELETE statement.
 Appendable printQuotedName(CharSequence name, Appendable sql)
          Prints quoted name (identifier) to SQL.
 Appendable printSequenceTable(MetaDatabase db, Appendable out)
          Print SQL CREATE SEQUENCE.
 Appendable printTable(MetaTable table, Appendable out)
          Print a SQL sript to create table
 
Methods inherited from class org.ujorm.orm.SqlDialect
createConnection, createJndiInitialContext, escape, getCriterionTemplate, getKeywordSet, getQuotedName, getSeqTableModel, isColumnLengthAllowed, isFilled, isMultiRowInsertSupported, printAlterTableAddColumn, printCall, printColumnAlias, printColumnDeclaration, printCommit, printConstraintName, printCreateSchema, printCriterion, printDefaultSchema, printDefaultValue, printFKColumnsDeclaration, printForeignKey, printForeignKey, printFullTableName, printFullTableName, printIndex, printInsert, printInsert, printInsertBySelect, println, printLockForSelect, printOffset, printSelect, printSelectOrder, printSelectTable, printSelectTableBase, printSelectView, printSequenceCurrentValue, printSequenceInit, printSequenceNextValue, printSequenceTableName, printTableAliasDefinition, printTableColumns, printUpdate, releaseSavepoint, setHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySqlDialect

public MySqlDialect()
Method Detail

getJdbcUrl

public String getJdbcUrl()
Description copied from class: SqlDialect
Returns a default JDBC URL

Specified by:
getJdbcUrl in class SqlDialect

getJdbcDriver

public String getJdbcDriver()
Description copied from class: SqlDialect
Returns a JDBC driver class name.

Specified by:
getJdbcDriver in class SqlDialect

printDelete

public Appendable printDelete(MetaTable table,
                              CriterionDecoder decoder,
                              Appendable out)
                       throws IOException
Print an SQL DELETE statement.

Overrides:
printDelete in class SqlDialect
Throws:
IOException

printSequenceTable

public Appendable printSequenceTable(MetaDatabase db,
                                     Appendable out)
                              throws IOException
Description copied from class: SqlDialect
Print SQL CREATE SEQUENCE. No JDBC parameters.

Overrides:
printSequenceTable in class SqlDialect
Throws:
IOException

printTable

public Appendable printTable(MetaTable table,
                             Appendable out)
                      throws IOException
Description copied from class: SqlDialect
Print a SQL sript to create table

Overrides:
printTable in class SqlDialect
Throws:
IOException

getEngine

protected String getEngine(MetaTable table)
Returns a MySQL enginge.
The default value is " ENGINE = InnoDB".


getColumnType

protected String getColumnType(MetaColumn column)
MySQL dialect uses a database type DATETIME (instead of the TIMESTAMP) for the java.util.Date.

Overrides:
getColumnType in class SqlDialect

printComment

public Appendable printComment(MetaTable table,
                               Appendable out)
                        throws IOException
Print a Comment on the table

Overrides:
printComment in class SqlDialect
Throws:
IOException

printComment

public Appendable printComment(MetaColumn column,
                               Appendable out)
                        throws IOException
Important note for MySQL: the change of column modifies all another column attributes so the comment update can revert some hand-made changes different from meta-model.
See the official MySQL documentation for more information. The column comments can be suppresed by the overwritting the method with an empty body.

Overrides:
printComment in class SqlDialect
Throws:
IOException

printQuotedName

public Appendable printQuotedName(CharSequence name,
                                  Appendable sql)
                           throws IOException
Prints quoted name (identifier) to SQL. Method is prepared for overriding based on SQL dialect.

Overrides:
printQuotedName in class SqlDialect
Parameters:
name - Name (identifier) for quoting
sql - Target SQL for printing new quoted name
Returns:
SQL with printed quoted name
Throws:
IOException


Copyright © 2012. All Rights Reserved.