return tableName;
}
}
public TableMetaData getTableMetaData(String tableName) {
TableMetaData result = new TableMetaData();
try {
result.setTableName(tableName);
DatabaseMetaData metaData = getDbSqlSession()
.getSqlSession()
.getConnection()
.getMetaData();
if ("postgres".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType())) {
tableName = tableName.toLowerCase();
}
ResultSet resultSet = metaData.getColumns(null, null, tableName, null);
while(resultSet.next()) {
String name = resultSet.getString("COLUMN_NAME").toUpperCase();
String type = resultSet.getString("TYPE_NAME").toUpperCase();
result.addColumnMetaData(name, type);
}
} catch (SQLException e) {
throw new ProcessEngineException("Could not retrieve database metadata: " + e.getMessage());
}
if(result.getColumnNames().size() == 0) {
// According to API, when a table doesn't exist, null should be returned
result = null;
}
return result;
}