|
From: Jeff J. <jj...@ap...> - 2010-11-26 02:04:18
|
Hi guys,
I encountered a problem with using schema names today. The funny
thing is there is a comment by gomma on the line I needed to change to
fix - line 116 of AbstractDatabaseConnection.java says "// TODO Think
about QualifiedTableNames here - needed or not?".
This is the current method:
public ITable createTable(String tableName) throws
DataSetException, SQLException
{
logger.debug("createTable(tableName={}) - start", tableName);
if (tableName == null) {
throw new NullPointerException("The parameter 'tableName'
must not be null");
}
String sql = "select * from " + tableName; // TODO Think about
QualifiedTableNames here - needed or not?
return this.createQueryTable(tableName, sql);
}
This is my suggested change:
public ITable createTable(String tableName) throws
DataSetException, SQLException
{
logger.debug("createTable(tableName={}) - start", tableName);
if (tableName == null) {
throw new NullPointerException("The parameter 'tableName'
must not be null");
}
// qualify with schema if configured
QualifiedTableName qualifiedTableName =
new QualifiedTableName(tableName, this.getSchema());
String qualifiedName = qualifiedTableName.getQualifiedName();
String sql = "select * from " + qualifiedName;
return this.createQueryTable(tableName, sql);
}
With adding the schema name to the table query, the problem I
encountered went away.
Do any of you see any problem with this change? If not, I will commit.
Existing dbUnit tests pass and another of my customer apps with lots
of dbUnit tests but no schema name still works.
It makes me wonder how tests with schemas currently work! They must
not be using this method!
|