org.apache.ddlutils.platform.mysql
Class MySqlModelReader

java.lang.Object
  extended byorg.apache.ddlutils.platform.JdbcModelReader
      extended byorg.apache.ddlutils.platform.mysql.MySqlModelReader
Direct Known Subclasses:
MySql50ModelReader

public class MySqlModelReader
extends JdbcModelReader

Reads a database model from a MySql database.

Version:
$Revision: $
Author:
Martin van den Bemt

Constructor Summary
MySqlModelReader(PlatformInfo platformInfo)
          Creates a new model reader for PostgreSql databases.
 
Method Summary
protected  boolean isInternalForeignKeyIndex(Table table, ForeignKey fk, Index index)
          Tries to determine whether the index is the internal database-generated index for the given foreign key. Note that only non-unique indices with the correct columns are fed to this method. Redefine this method for specific platforms if there are better ways to determine internal indices.
protected  boolean isInternalPrimaryKeyIndex(Table table, Index index)
          Tries to determine whether the index is the internal database-generated index for the given table's primary key. Note that only unique indices with the correct columns are fed to this method. Redefine this method for specific platforms if there are better ways to determine internal indices.
protected  Column readColumn(DatabaseMetaDataWrapper metaData, Map values)
          Extracts a column definition from the result set.
protected  Table readTable(DatabaseMetaDataWrapper metaData, Map values)
          Reads the next table from the meta data.
 
Methods inherited from class org.apache.ddlutils.platform.JdbcModelReader
determineAutoIncrementFromResultSetMetaData, getColumnsForColumn, getColumnsForFK, getColumnsForIndex, getColumnsForPK, getColumnsForTable, getConnection, getDatabase, getDatabase, getDefaultCatalogPattern, getDefaultSchemaPattern, getDefaultTablePattern, getDefaultTableTypes, getPlatformInfo, initColumnsForColumn, initColumnsForFK, initColumnsForIndex, initColumnsForPK, initColumnsForTable, matches, readColumns, readForeignKey, readForeignKeys, readIndex, readIndices, readPrimaryKeyName, readPrimaryKeyNames, readTables, removeInternalForeignKeyIndex, removeInternalPrimaryKeyIndex, removeSystemIndices, setDefaultCatalogPattern, setDefaultSchemaPattern, setDefaultTablePattern, setDefaultTableTypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySqlModelReader

public MySqlModelReader(PlatformInfo platformInfo)
Creates a new model reader for PostgreSql databases.

Parameters:
platformInfo - The platform specific settings
Method Detail

readTable

protected Table readTable(DatabaseMetaDataWrapper metaData,
                          Map values)
                   throws SQLException
Reads the next table from the meta data.

Overrides:
readTable in class JdbcModelReader
Parameters:
metaData - The database meta data
values - The table metadata values as defined by JdbcModelReader.getColumnsForTable()
Returns:
The table or null if the result set row did not contain a valid table
Throws:
SQLException

readColumn

protected Column readColumn(DatabaseMetaDataWrapper metaData,
                            Map values)
                     throws SQLException
Extracts a column definition from the result set.

Overrides:
readColumn in class JdbcModelReader
Parameters:
metaData - The database meta data
values - The column meta data values as defined by JdbcModelReader.getColumnsForColumn()
Returns:
The column
Throws:
SQLException

isInternalPrimaryKeyIndex

protected boolean isInternalPrimaryKeyIndex(Table table,
                                            Index index)
Tries to determine whether the index is the internal database-generated index for the given table's primary key. Note that only unique indices with the correct columns are fed to this method. Redefine this method for specific platforms if there are better ways to determine internal indices.

Overrides:
isInternalPrimaryKeyIndex in class JdbcModelReader
Parameters:
table - The table owning the index
index - The index to check
Returns:
true if the index seems to be an internal primary key one

isInternalForeignKeyIndex

protected boolean isInternalForeignKeyIndex(Table table,
                                            ForeignKey fk,
                                            Index index)
Tries to determine whether the index is the internal database-generated index for the given foreign key. Note that only non-unique indices with the correct columns are fed to this method. Redefine this method for specific platforms if there are better ways to determine internal indices.

Overrides:
isInternalForeignKeyIndex in class JdbcModelReader
Parameters:
table - The table owning the index and foreign key
fk - The foreign key
index - The index to check
Returns:
true if the index seems to be an internal primary key one


Copyright © 2005 Apache Software Foundation. All Rights Reserved.