com.jenkov.mrpersister.impl.mapping
Class DbNameDeterminerOld

java.lang.Object
  extended by com.jenkov.mrpersister.impl.mapping.DbNameDeterminerOld
All Implemented Interfaces:
IDbNameDeterminer

public class DbNameDeterminerOld
extends java.lang.Object
implements IDbNameDeterminer


Constructor Summary
DbNameDeterminerOld()
           
 
Method Summary
 java.lang.String determineColumnName(java.util.Collection names, java.lang.String tableName, java.sql.Connection connection)
          Determines which, if any, of the given possible column names in the given collection is matching a column name in the given table.
 java.lang.String determineTableName(java.util.Collection names, java.sql.Connection connection)
          Determines which, if any, of the given possible table names in the given collection is matching a table name in the database.
 java.lang.String determineTableName(java.util.Collection names, java.lang.String databaseName, java.sql.Connection connection)
          Determines which, if any, of the given possible table names in the given collection is matching a table name in the database.
 int getColumnType(java.lang.String columnName, java.lang.String tableName)
          Returns the type for a given column in a given table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbNameDeterminerOld

public DbNameDeterminerOld()
Method Detail

getColumnType

public int getColumnType(java.lang.String columnName,
                         java.lang.String tableName)
Description copied from interface: IDbNameDeterminer
Returns the type for a given column in a given table. Note, this method only works if the determineColumnName worked (returned a name != null)

Specified by:
getColumnType in interface IDbNameDeterminer
Parameters:
columnName - The name of the column to get the data type for.
tableName - The name of the table where the column is defined.
Returns:
An int matching one of the java.sql.Types.XXX type constants.

determineColumnName

public java.lang.String determineColumnName(java.util.Collection names,
                                            java.lang.String tableName,
                                            java.sql.Connection connection)
                                     throws PersistenceException
Description copied from interface: IDbNameDeterminer
Determines which, if any, of the given possible column names in the given collection is matching a column name in the given table. If no column name is matching any of the names in the collection null is returned. If more than one of the possible column names matches a column in the table, a PersistenceException is thrown.

Specified by:
determineColumnName in interface IDbNameDeterminer
Parameters:
names - The collection of possible column names.
tableName - The name of the database table to check for column matches in.
connection - The connection to the database to determine column name in.
Returns:
The matching column name. Null if no matching column name was found.
Throws:
PersistenceException - If anything goes wrong during the name determining, or if more than one of the possible column names matches a column in the table.

determineTableName

public java.lang.String determineTableName(java.util.Collection names,
                                           java.sql.Connection connection)
                                    throws PersistenceException
Description copied from interface: IDbNameDeterminer
Determines which, if any, of the given possible table names in the given collection is matching a table name in the database. If no table name is matching any of the names in the collection a PersistenceException is thrown. If more than one of the possible table names matches a table in the database a PersistenceException is also thrown.

Specified by:
determineTableName in interface IDbNameDeterminer
Parameters:
names - The collection of possible table names.
connection - The connection to the database to determine table name in.
Returns:
The matching table name.
Throws:
PersistenceException - If anything goes wrong during the name determining, or if none or more than one of the possible table names matches a table in the database.

determineTableName

public java.lang.String determineTableName(java.util.Collection names,
                                           java.lang.String databaseName,
                                           java.sql.Connection connection)
                                    throws PersistenceException
Description copied from interface: IDbNameDeterminer
Determines which, if any, of the given possible table names in the given collection is matching a table name in the database. If no table name is matching any of the names in the collection a PersistenceException is thrown. If more than one of the possible table names matches a table in the database a PersistenceException is also thrown.

Specified by:
determineTableName in interface IDbNameDeterminer
Parameters:
names - The collection of possible table names.
databaseName - The name of the database. Set to null if not known. The database name is usually implicitly referenced in the database connection, so you most often won't need to set this parameter to anything but null.
connection - The connection to the database to determine table name in.
Returns:
The matching table name.
Throws:
PersistenceException - If anything goes wrong during the name determining, or if none or more than one of the possible table names matches a table in the database.