public String[] findSchemaDetails(Connection conn)
throws SQLException
{
String[] schemaDetails = new String[2];
DatabaseMetaData dmd = conn.getMetaData();
// Make sure the table name is in the correct case.
// This is required by RDBMS such as PostgreSQL which allow creation in one format yet
// actually store it in another.
String table_name = identifier.getIdentifierName();
if (storeMgr.getIdentifierFactory().getIdentifierCase() == IdentifierCase.LOWER_CASE ||
storeMgr.getIdentifierFactory().getIdentifierCase() == IdentifierCase.LOWER_CASE_QUOTED)
{
table_name = table_name.toLowerCase();
}
else if (storeMgr.getIdentifierFactory().getIdentifierCase() == IdentifierCase.UPPER_CASE ||
storeMgr.getIdentifierFactory().getIdentifierCase() == IdentifierCase.UPPER_CASE_QUOTED)
{
table_name = table_name.toUpperCase();
}
// Utilise default catalog/schema if available and applicable
String catalog_name = storeMgr.getStringProperty("datanucleus.mapping.Catalog");
String schema_name = storeMgr.getStringProperty("datanucleus.mapping.Schema");
if (!dba.supportsOption(DatastoreAdapter.CATALOGS_IN_TABLE_DEFINITIONS))
{
catalog_name = null;
}
if (!dba.supportsOption(DatastoreAdapter.SCHEMAS_IN_TABLE_DEFINITIONS))
{
schema_name = null;
}
// Find the schema details
ResultSet rs = dmd.getTables(catalog_name,schema_name,table_name,null);
try
{
if (!rs.next())
{
throw new NucleusDataStoreException(LOCALISER.msg("057027",identifier));