Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.j256.ormlite.db;
 import java.util.List;
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.

public class MysqlDatabaseType extends BaseDatabaseType implements DatabaseType {
	private final static String DATABASE_URL_PORTION = "mysql";
	private final static String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
	private final static String DATABASE_NAME = "MySQL";

Default suffix to the CREATE TABLE statement. Change with the setCreateTableSuffix(java.lang.String) method.
	public final static String DEFAULT_CREATE_TABLE_SUFFIX = "ENGINE=InnoDB";
	public boolean isDatabaseUrlThisType(String urlString dbTypePart) {
		return .equals(dbTypePart);
	protected String getDriverClassName() {
	public String getDatabaseName() {
		return ;

Set the string that is appended to the end of a CREATE TABLE statement.
	public void setCreateTableSuffix(String createTableSuffix) {
		this. = createTableSuffix;
	protected void appendDateType(StringBuilder sbint fieldWidth) {
TIMESTAMP in MySQL does some funky stuff with the last-modification time. Values are 'not null' by default with an automatic default of CURRENT_TIMESTAMP. Strange design decision.
	protected void appendBooleanType(StringBuilder sb) {
	protected void configureGeneratedId(StringBuilder sbFieldType fieldTypeList<StringstatementsBefore,
			List<StringadditionalArgsList<StringqueriesAfter) {
		sb.append("AUTO_INCREMENT ");
		sb.append(' ');
	public boolean isTruncateSupported() {
		return true;
	public boolean isCreateIfNotExistsSupported() {
		return true;
New to GrepCode? Check out our FAQ X