|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.openjpa.jdbc.sql.DBDictionary
org.apache.openjpa.jdbc.sql.MySQLDictionary
public class MySQLDictionary
Dictionary for MySQL.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary |
|---|
DBDictionary.SerializedData |
| Field Summary | |
|---|---|
static java.lang.String |
DELIMITER_BACK_TICK
|
boolean |
driverDeserializesBlobs
Whether the driver automatically deserializes blobs. |
static java.lang.String |
longBlobTypeName
|
static java.lang.String |
mediumBlobTypeName
|
boolean |
optimizeMultiTableDeletes
Whether to inline multi-table bulk-delete operations into MySQL's combined DELETE FROM foo, bar, baz syntax. |
static java.lang.String |
SELECT_HINT
|
java.lang.String |
tableType
The MySQL table type to use when creating tables; defaults to innodb. |
static java.lang.String |
tinyBlobTypeName
|
boolean |
useClobs
Whether to use clobs; defaults to true. |
| 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,
boolean subselect)
If this dictionary can select ranges, use this method to append the range SQL. |
void |
appendXmlComparison(SQLBuffer buf,
java.lang.String op,
FilterValue lhs,
FilterValue rhs,
boolean lhsxml,
boolean rhsxml)
Append XML comparison. |
void |
connectedConfiguration(java.sql.Connection conn)
This method is called when the dictionary first sees any connection. |
java.sql.Connection |
decorate(java.sql.Connection conn)
Decorate the given connection if needed. |
java.lang.String[] |
getAddPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to add the given primary key to its table. |
int |
getBatchFetchSize(int batchFetchSize)
|
java.lang.Object |
getBlobObject(java.sql.ResultSet rs,
int column,
JDBCStore store)
Convert the specified column of the SQL ResultSet to the proper java type. |
java.lang.String[] |
getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns. |
java.lang.String[] |
getDeleteTableContentsSQL(Table[] tables,
java.sql.Connection conn)
Create SQL to delete the contents of the specified tables. |
java.lang.String[] |
getDropForeignKeySQL(ForeignKey fk,
java.sql.Connection conn)
Return ALTER TABLE <table name> DROP FOREIGN KEY
<fk name>. |
java.lang.String[] |
getDropIndexSQL(Index index)
Return a series of SQL statements to drop the given index. |
java.lang.String[] |
getDropPrimaryKeySQL(PrimaryKey pk)
Return ALTER TABLE <table name> DROP PRIMARY KEY. |
int |
getPreferredType(int type)
Return the preferred Types type for the given one. |
java.lang.String |
getSelectOperation(JDBCFetchConfiguration fetch)
Check to see if we have set the SELECT_HINT in the
fetch configuration, and if so, append the MySQL hint after the
"SELECT" part of the query. |
protected java.util.Collection<java.lang.String> |
getSelectTableAliases(Select sel)
|
java.lang.String |
getTypeName(Column col)
OPENJPA-740 Special case for MySql special column types, like LONGTEXT, LONGBLOG etc.. |
boolean |
isFatalException(int subtype,
java.sql.SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). |
protected int |
matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates,
java.sql.SQLException ex)
Determine the more appropriate type of store exception by matching the SQL Error State of the the given SQLException to the given Error States categorized by error types. |
protected Column |
newColumn(java.sql.ResultSet colMeta)
Create a new column from the information in the schema metadata. |
| 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 SELECT_HINT
public static final java.lang.String DELIMITER_BACK_TICK
public java.lang.String tableType
public boolean useClobs
public boolean driverDeserializesBlobs
public boolean optimizeMultiTableDeletes
DELETE FROM foo, bar, baz syntax.
Defaults to false, since this may fail in the presence of InnoDB tables
with foreign keys.
http://dev.mysql.com/doc/refman/5.0/en/delete.htmlpublic static final java.lang.String tinyBlobTypeName
public static final java.lang.String mediumBlobTypeName
public static final java.lang.String longBlobTypeName
| Constructor Detail |
|---|
public MySQLDictionary()
| Method Detail |
|---|
public void connectedConfiguration(java.sql.Connection conn)
throws java.sql.SQLException
DBDictionarysuper.connectedConfiguration.
connectedConfiguration in class DBDictionaryjava.sql.SQLException
public java.sql.Connection decorate(java.sql.Connection conn)
throws java.sql.SQLException
DBDictionaryDBDictionary.initializationSQL that has been set for the dictionary but
does not decorate the connection.
decorate in interface ConnectionDecoratordecorate in class DBDictionaryjava.sql.SQLExceptionpublic java.lang.String[] getCreateTableSQL(Table table)
DBDictionary
getCreateTableSQL in class DBDictionarypublic java.lang.String[] getDropIndexSQL(Index index)
DBDictionaryDROP INDEX <index name> by default.
getDropIndexSQL in class DBDictionarypublic java.lang.String[] getDropPrimaryKeySQL(PrimaryKey pk)
ALTER TABLE <table name> DROP PRIMARY KEY.
getDropPrimaryKeySQL in class DBDictionary
public java.lang.String[] getDropForeignKeySQL(ForeignKey fk,
java.sql.Connection conn)
ALTER TABLE <table name> DROP FOREIGN KEY
<fk name>.
getDropForeignKeySQL in class DBDictionarypublic java.lang.String[] getAddPrimaryKeySQL(PrimaryKey pk)
DBDictionaryALTER TABLE <table name> ADD
<pk cons sql > by default.
getAddPrimaryKeySQL in class DBDictionary
public java.lang.String[] getDeleteTableContentsSQL(Table[] tables,
java.sql.Connection conn)
DBDictionary
getDeleteTableContentsSQL in class DBDictionary
protected void appendSelectRange(SQLBuffer buf,
long start,
long end,
boolean subselect)
DBDictionary
appendSelectRange in class DBDictionary
protected Column newColumn(java.sql.ResultSet colMeta)
throws java.sql.SQLException
DBDictionary
newColumn in class DBDictionaryjava.sql.SQLException
public java.lang.Object getBlobObject(java.sql.ResultSet rs,
int column,
JDBCStore store)
throws java.sql.SQLException
DBDictionary
getBlobObject in class DBDictionaryjava.sql.SQLExceptionpublic int getPreferredType(int type)
DBDictionaryTypes type for the given one. Returns
the given type by default.
getPreferredType in class DBDictionary
public void appendXmlComparison(SQLBuffer buf,
java.lang.String op,
FilterValue lhs,
FilterValue rhs,
boolean lhsxml,
boolean rhsxml)
appendXmlComparison in class DBDictionarybuf - the SQL buffer to write the comparisonop - the comparison operation to performlhs - the left hand side of the comparisonrhs - the right hand side of the comparisonlhsxml - indicates whether the left operand maps to XMLrhsxml - indicates whether the right operand maps to XMLpublic int getBatchFetchSize(int batchFetchSize)
getBatchFetchSize in class DBDictionarypublic java.lang.String getSelectOperation(JDBCFetchConfiguration fetch)
SELECT_HINT in the
fetch configuration, and if so, append the MySQL hint after the
"SELECT" part of the query.
getSelectOperation in class DBDictionaryprotected java.util.Collection<java.lang.String> getSelectTableAliases(Select sel)
getSelectTableAliases in class DBDictionary
protected int matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates,
java.sql.SQLException ex)
DBDictionary
matchErrorState in class DBDictionaryerrorStates - classification of SQL error states by their specific nature. The keys of the
map represent one of the constants defined in StoreException. The value corresponding to
a key represent the set of SQL Error States representing specific category of database error.
This supplied map is sourced from sql-error-state-codes.xml and filtered the
error states for the current database.ex - original SQL Exception as raised by the database driver.
- Returns:
- A constant indicating the category of error as defined in
StoreException.
public boolean isFatalException(int subtype,
java.sql.SQLException ex)
DBDictionary
isFatalException in class DBDictionarysubtype - A constant indicating the category of error as defined in StoreException.ex - original SQL Exception as raised by the database driver.
public java.lang.String getTypeName(Column col)
getTypeName in class DBDictionaryDBDictionary.getTypeName(org.apache.openjpa.jdbc.schema.Column)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||