com.j256.ormlite.db
Class MysqlDatabaseType

java.lang.Object
  extended by com.j256.ormlite.db.BaseDatabaseType
      extended by com.j256.ormlite.db.MysqlDatabaseType
All Implemented Interfaces:
DatabaseType

public class MysqlDatabaseType
extends BaseDatabaseType
implements DatabaseType

MySQL database type information used to create the tables, etc..

NOTE: By default the tables are created with the ENGINE=InnoDB suffix (see DEFAULT_CREATE_TABLE_SUFFIX. Use setCreateTableSuffix(java.lang.String) to change that to "" to use the default MyISAM storage engine, to choose another engine, or set other settings. For more information about engines, see the 'SHOW ENGINES;' results from the MySQL command line tool.

Author:
graywatson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.j256.ormlite.db.BaseDatabaseType
BaseDatabaseType.BooleanNumberFieldConverter
 
Field Summary
static String DEFAULT_CREATE_TABLE_SUFFIX
          Default suffix to the CREATE TABLE statement.
 
Fields inherited from class com.j256.ormlite.db.BaseDatabaseType
booleanConverter
 
Constructor Summary
MysqlDatabaseType()
           
 
Method Summary
protected  void appendBooleanType(StringBuilder sb)
          Output the SQL type for a Java boolean.
 void appendCreateTableSuffix(StringBuilder sb)
          Append the SQL necessary to properly finish a CREATE TABLE line.
protected  void appendDateType(StringBuilder sb)
          Output the SQL type for a Java Date.
protected  void appendObjectType(StringBuilder sb)
          Output the SQL type for a Java object.
protected  void configureGeneratedId(StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> additionalArgs, List<String> queriesAfter)
          Output the SQL necessary to configure a generated-id column.
 String getDriverClassName()
          Return the class name of the database driver.
 String getDriverUrlPart()
          Return the part in the database URI which identifies the particular database.
 void setCreateTableSuffix(String createTableSuffix)
          Set the string that is appended to the end of a CREATE TABLE statement.
 
Methods inherited from class com.j256.ormlite.db.BaseDatabaseType
appendByteType, appendCanBeNull, appendColumnArg, appendDefaultValue, appendDoubleType, appendEnumIntType, appendEnumStringType, appendEscapedEntityName, appendEscapedWord, appendFloatType, appendIntegerType, appendLimitValue, appendLongType, appendSelectNextValFromSequence, appendShortType, appendStringType, buildDatabaseAccess, configureGeneratedIdSequence, configureId, convertColumnName, dropColumnArg, generateIdSequenceName, getCommentLinePrefix, getDefaultVarcharWidth, getFieldConverter, isCreateTableReturnsZero, isEntityNamesMustBeUpCase, isIdSequenceNeeded, isLimitAfterSelect, isLimitSqlSupported, isVarcharFieldWidthSupported, loadDriver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.j256.ormlite.db.DatabaseType
appendColumnArg, appendEscapedEntityName, appendEscapedWord, appendLimitValue, appendSelectNextValFromSequence, buildDatabaseAccess, convertColumnName, dropColumnArg, generateIdSequenceName, getCommentLinePrefix, getFieldConverter, isCreateTableReturnsZero, isEntityNamesMustBeUpCase, isIdSequenceNeeded, isLimitAfterSelect, isLimitSqlSupported, isVarcharFieldWidthSupported, loadDriver
 

Field Detail

DEFAULT_CREATE_TABLE_SUFFIX

public static final String DEFAULT_CREATE_TABLE_SUFFIX
Default suffix to the CREATE TABLE statement. Change with the setCreateTableSuffix(java.lang.String) method.

See Also:
Constant Field Values
Constructor Detail

MysqlDatabaseType

public MysqlDatabaseType()
Method Detail

getDriverUrlPart

public String getDriverUrlPart()
Description copied from interface: DatabaseType
Return the part in the database URI which identifies the particular database. Usually the URI is in the form jdbc:ddd:... where ddd is the driver url part.

Specified by:
getDriverUrlPart in interface DatabaseType

getDriverClassName

public String getDriverClassName()
Description copied from interface: DatabaseType
Return the class name of the database driver.

Specified by:
getDriverClassName in interface DatabaseType

setCreateTableSuffix

public void setCreateTableSuffix(String createTableSuffix)
Set the string that is appended to the end of a CREATE TABLE statement.


appendDateType

protected void appendDateType(StringBuilder sb)
Description copied from class: BaseDatabaseType
Output the SQL type for a Java Date.

Overrides:
appendDateType in class BaseDatabaseType

appendBooleanType

protected void appendBooleanType(StringBuilder sb)
Description copied from class: BaseDatabaseType
Output the SQL type for a Java boolean.

Overrides:
appendBooleanType in class BaseDatabaseType

appendObjectType

protected void appendObjectType(StringBuilder sb)
Description copied from class: BaseDatabaseType
Output the SQL type for a Java object.

Overrides:
appendObjectType in class BaseDatabaseType

configureGeneratedId

protected void configureGeneratedId(StringBuilder sb,
                                    FieldType fieldType,
                                    List<String> statementsBefore,
                                    List<String> additionalArgs,
                                    List<String> queriesAfter)
Description copied from class: BaseDatabaseType
Output the SQL necessary to configure a generated-id column. This may add to the before statements list or additional arguments later. NOTE: Only one of configureGeneratedIdSequence, configureGeneratedId, or configureId will be called.

Overrides:
configureGeneratedId in class BaseDatabaseType

appendCreateTableSuffix

public void appendCreateTableSuffix(StringBuilder sb)
Description copied from interface: DatabaseType
Append the SQL necessary to properly finish a CREATE TABLE line.

Specified by:
appendCreateTableSuffix in interface DatabaseType
Overrides:
appendCreateTableSuffix in class BaseDatabaseType


Copyright © 2010. All Rights Reserved.