Skip to content

Commit

Permalink
0003039: Wildcard table names don't work on Informix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Apr 4, 2017
1 parent 2d551c6 commit 5a66ef9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Expand Up @@ -71,7 +71,10 @@ public String getName() {
}

public String getDefaultCatalog() {
return null;
// if (StringUtils.isBlank(defaultCatalog)) {
// defaultCatalog = getSqlTemplate().queryForObject("select trim(sqc_currdb) from sysmaster:syssqlcurall where sqc_sessionid = dbinfo('sessionid')", String.class);
// }
return defaultCatalog;
}

public String getDefaultSchema() {
Expand Down
Expand Up @@ -20,6 +20,8 @@
*/
package org.jumpmind.db.platform.informix;

import static org.apache.commons.lang.StringUtils.isBlank;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
Expand Down Expand Up @@ -50,8 +52,22 @@ public InformixDdlReader(IDatabasePlatform platform) {
super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
}

@Override
protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData, Map<String, Object> values) throws SQLException {
String catalog = metaData.getCatalog();
Table t = super.readTable(connection, metaData, values);
if (t != null && (isBlank(catalog) || catalog.equals(getDefaultCatalogPattern()))) {
/* The default catalog is null so by default if no
* catalog is provided it must be null as well */
t.setCatalog(null);
}
return t;
}


@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Collection<IIndex> readIndices(Connection connection, DatabaseMetaDataWrapper metaData,
String tableName) throws SQLException {
Expand Down

0 comments on commit 5a66ef9

Please sign in to comment.