org.apache.openjpa.jdbc.sql
Class MySQLDictionary

java.lang.Object
  extended by org.apache.openjpa.jdbc.sql.DBDictionary
      extended by org.apache.openjpa.jdbc.sql.MySQLDictionary
All Implemented Interfaces:
JoinSyntaxes, Configurable, ConnectionDecorator, LoggingConnectionDecorator.SQLWarningHandler

public class MySQLDictionary
extends DBDictionary

Dictionary for MySQL.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
DBDictionary.SerializedData
 
Field Summary
 boolean driverDeserializesBlobs
          Whether the driver automatically deserializes blobs.
 String tableType
          The MySQL table type to use when creating tables; defaults to innodb.
 boolean useClobs
          Whether to use clobs.
 
Fields inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
allowsAliasInBulkClause, arrayTypeName, autoAssignClause, autoAssignTypeName, bigintTypeName, binaryTypeName, bitLengthFunction, bitTypeName, blobTypeName, booleanTypeName, castFunction, catalogSeparator, CENTI, characterColumnSize, charTypeName, clobTypeName, closePoolSQL, concatenateDelimiter, concatenateFunction, conf, connected, CONS_NAME_AFTER, CONS_NAME_BEFORE, CONS_NAME_MID, constraintNameMode, createPrimaryKeys, crossJoinClause, currentDateFunction, currentTimeFunction, currentTimestampFunction, datePrecision, dateTypeName, DECI, decimalTypeName, distinctCountColumnSeparator, distinctTypeName, doubleTypeName, driverVendor, dropTableSQL, fixedSizeTypeNames, fixedSizeTypeNameSet, floatTypeName, forUpdateClause, initializationSQL, innerJoinClause, integerTypeName, javaObjectTypeName, joinSyntax, lastGeneratedKeyQuery, log, longVarbinaryTypeName, longVarcharTypeName, maxAutoAssignNameLength, maxColumnNameLength, maxConstraintNameLength, maxEmbeddedBlobSize, maxEmbeddedClobSize, maxIndexesPerTable, maxIndexNameLength, maxTableNameLength, MICRO, MILLI, NAME_ANY, NAME_SEQUENCE, NAME_TABLE, NANO, nextSequenceQuery, nullTypeName, numericTypeName, otherTypeName, outerJoinClause, platform, RANGE_POST_DISTINCT, RANGE_POST_LOCK, RANGE_POST_SELECT, RANGE_PRE_DISTINCT, rangePosition, realTypeName, refTypeName, requiresAliasForSubselect, requiresAutoCommitForMetaData, requiresCastForComparisons, requiresCastForMathFunctions, requiresConditionForCrossJoin, reservedWords, reservedWordSet, SCHEMA_CASE_LOWER, SCHEMA_CASE_PRESERVE, SCHEMA_CASE_UPPER, schemaCase, searchStringEscape, SEC, simulateLocking, smallintTypeName, storageLimitationsFatal, storeCharsAsNumbers, storeLargeNumbersAsStrings, stringLengthFunction, structTypeName, substringFunctionName, supportsAlterTableWithAddColumn, supportsAlterTableWithDropColumn, supportsAutoAssign, supportsCascadeDeleteAction, supportsCascadeUpdateAction, supportsCorrelatedSubselect, supportsDefaultDeleteAction, supportsDefaultUpdateAction, supportsDeferredConstraints, supportsForeignKeys, supportsHaving, supportsLockingWithDistinctClause, supportsLockingWithInnerJoin, supportsLockingWithMultipleTables, supportsLockingWithOrderClause, supportsLockingWithOuterJoin, supportsLockingWithSelectRange, supportsModOperator, supportsMultipleNontransactionalResultSets, supportsNullDeleteAction, supportsNullTableForGetColumns, supportsNullTableForGetImportedKeys, supportsNullTableForGetIndexInfo, supportsNullTableForGetPrimaryKeys, supportsNullUpdateAction, supportsQueryTimeout, supportsRestrictDeleteAction, supportsRestrictUpdateAction, supportsSchemaForGetColumns, supportsSchemaForGetTables, supportsSelectEndIndex, supportsSelectForUpdate, supportsSelectStartIndex, supportsSubselect, supportsTimestampNanos, supportsUniqueConstraints, systemSchemas, systemSchemaSet, systemTables, systemTableSet, tableForUpdateClause, tableTypes, timestampTypeName, timeTypeName, tinyintTypeName, toLowerCaseFunction, toUpperCaseFunction, trimBothFunction, trimLeadingFunction, trimTrailingFunction, useGetBestRowIdentifierForPrimaryKeys, useGetBytesForBlobs, useGetObjectForBlobs, useGetStringForClobs, useSchemaName, useSetBytesForBlobs, useSetStringForClobs, validationSQL, varbinaryTypeName, varcharTypeName, VENDOR_DATADIRECT, VENDOR_OTHER
 
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL
 
Constructor Summary
MySQLDictionary()
           
 
Method Summary
protected  void appendSelectRange(SQLBuffer buf, long start, long end)
          If this dictionary can select ranges, use this method to append the range SQL.
 String[] getAddPrimaryKeySQL(PrimaryKey pk)
          Return a series of SQL statements to add the given primary key to its table.
 Object getBlobObject(ResultSet rs, int column, JDBCStore store)
          Convert the specified column of the SQL ResultSet to the proper java type.
 String[] getCreateTableSQL(Table table)
          Return a series of SQL statements to create the given table, complete with columns.
 String[] getDropIndexSQL(Index index)
          Return a series of SQL statements to drop the given index.
protected  String getForeignKeyConstraintSQL(ForeignKey fk)
          Return the declaration SQL for the given foreign key, or null if it is not supported.
 int getPreferredType(int type)
          Return the preferred Types type for the given one.
protected  Column newColumn(ResultSet colMeta)
          Create a new column from the information in the schema metadata.
 
Methods inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
appendCast, appendNumericCast, appendSize, appendUpdates, assertSupport, canOuterJoin, closeDataSource, comparison, connectedConfiguration, convertSchemaCase, decorate, endConfiguration, getAddColumnSQL, getAddForeignKeySQL, getArray, getAsciiStream, getBigDecimal, getBigInteger, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getCalendar, getCatalogNameForMetadata, getChar, getCharacterStream, getClob, getClobString, getColumnNameForMetadata, getColumns, getCreateIndexSQL, getCreateSequenceSQL, getDate, getDate, getDeclareColumnSQL, getDouble, getDropColumnSQL, getDropForeignKeySQL, getDropPrimaryKeySQL, getDropSequenceSQL, getDropTableSQL, getFloat, getFrom, getFromSelect, getFullName, getFullName, getFullName, getGeneratedKey, getGeneratedKeySequenceName, getImportedKeys, getIndexInfo, getInt, getJDBCType, getLocale, getLong, getNumber, getObject, getPlaceholderValueString, getPrimaryKeyConstraintSQL, getPrimaryKeys, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromGetPrimaryKeys, getRef, getSchemaNameForMetadata, getSelectOperation, getSelects, getSequences, getSequencesSQL, getShort, getString, getTableNameForMetadata, getTables, getTime, getTimestamp, getTypeName, getTypeName, getUniqueConstraintSQL, getValidColumnName, getValidForeignKeyName, getValidIndexName, getValidPrimaryKeyName, getValidSequenceName, getValidTableName, getValidUniqueName, getWhere, handleWarning, indexOf, isSystemIndex, isSystemSequence, isSystemTable, makeNameValid, mathFunction, newForeignKey, newIndex, newPrimaryKey, newSequence, newStoreException, newTable, putBytes, putChars, putString, refSchemaComponents, serialize, setArray, setAsciiStream, setBigDecimal, setBigInteger, setBinaryStream, setBlob, setBlobObject, setBoolean, setByte, setBytes, setCalendar, setChar, setCharacterStream, setClob, setClobString, setConfiguration, setDate, setDate, setDouble, setFloat, setInt, setJoinSyntax, setLocale, setLong, setNull, setNumber, setObject, setRef, setShort, setString, setTime, setTimestamp, setTyped, setUnknown, shorten, startConfiguration, storageWarning, substring, supportsDeleteAction, supportsLocking, supportsRandomAccessResultSet, supportsUpdateAction, toBulkOperation, toDelete, toNativeJoin, toOperation, toSelect, toSelect, toSelectCount, toSQL92Join, toTraditionalJoin, toUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableType

public String tableType
The MySQL table type to use when creating tables; defaults to innodb.


useClobs

public boolean useClobs
Whether to use clobs. Some older versions of MySQL do not handle clobs properly so we default to false here.


driverDeserializesBlobs

public boolean driverDeserializesBlobs
Whether the driver automatically deserializes blobs.

Constructor Detail

MySQLDictionary

public MySQLDictionary()
Method Detail

getCreateTableSQL

public String[] getCreateTableSQL(Table table)
Description copied from class: DBDictionary
Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.

Overrides:
getCreateTableSQL in class DBDictionary

getDropIndexSQL

public String[] getDropIndexSQL(Index index)
Description copied from class: DBDictionary
Return a series of SQL statements to drop the given index. Returns DROP INDEX <index name> by default.

Overrides:
getDropIndexSQL in class DBDictionary

getAddPrimaryKeySQL

public String[] getAddPrimaryKeySQL(PrimaryKey pk)
Description copied from class: DBDictionary
Return a series of SQL statements to add the given primary key to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD <pk cons sql > by default.

Overrides:
getAddPrimaryKeySQL in class DBDictionary

getForeignKeyConstraintSQL

protected String getForeignKeyConstraintSQL(ForeignKey fk)
Description copied from class: DBDictionary
Return the declaration SQL for the given foreign key, or null if it is not supported. This method is used from within DBDictionary.getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table) and DBDictionary.getAddForeignKeySQL(org.apache.openjpa.jdbc.schema.ForeignKey). Returns CONSTRAINT <cons name> FOREIGN KEY (<col list>) REFERENCES <foreign table> (<col list>) [ON DELETE <action>] [ON UPDATE <action>] by default.

Overrides:
getForeignKeyConstraintSQL in class DBDictionary

appendSelectRange

protected void appendSelectRange(SQLBuffer buf,
                                 long start,
                                 long end)
Description copied from class: DBDictionary
If this dictionary can select ranges, use this method to append the range SQL.

Overrides:
appendSelectRange in class DBDictionary

newColumn

protected Column newColumn(ResultSet colMeta)
                    throws SQLException
Description copied from class: DBDictionary
Create a new column from the information in the schema metadata.

Overrides:
newColumn in class DBDictionary
Throws:
SQLException

getBlobObject

public Object getBlobObject(ResultSet rs,
                            int column,
                            JDBCStore store)
                     throws SQLException
Description copied from class: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.

Overrides:
getBlobObject in class DBDictionary
Throws:
SQLException

getPreferredType

public int getPreferredType(int type)
Description copied from class: DBDictionary
Return the preferred Types type for the given one. Returns the given type by default.

Overrides:
getPreferredType in class DBDictionary


Copyright © 2006 Apache Software Foundation. All Rights Reserved.