Skip to content

Commit

Permalink
MONDRIAN: Integrating change #13016, fixes for PSW-56 and PSW-57. upd…
Browse files Browse the repository at this point in the history
…ated logic for lazy loading table column information, also added resource to text.properties to avoid error messages in console.

[git-p4: depot-paths = "//open/mondrian-release/3.1/": change = 13017]
  • Loading branch information
Will Gorman committed Aug 25, 2009
1 parent b778963 commit d3a6776
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 34 deletions.
48 changes: 15 additions & 33 deletions src/main/mondrian/gui/JdbcMetaData.java
Expand Up @@ -355,38 +355,25 @@ private void setPKey(DbTable dbt) {
private void setColumns(String schemaName, String tableName) {
LOGGER.debug(
"setColumns: <" + tableName + "> in schema <" + schemaName + ">");

if (initConnection() != null) {
return;
}

if (schemaName == null) {
schemaName = jdbcSchema;
}

DbSchema dbs = db.getSchema(schemaName);

if (dbs == null) {
throw new RuntimeException(
"No schema with name: <" + schemaName + ">");
}

DbTable dbt = dbs.getTable(tableName);

DbTable dbt = db.getTable(schemaName, tableName);
if (dbt == null) {
throw new RuntimeException(
LOGGER.debug(
"No table with name: <"
+ tableName
+ "> in schema <"
+ schemaName
+ ">");
return;
}
if (initConnection() != null) {
return;
}
try {
setColumns(dbt);
LOGGER.debug("got " + dbt.colsDataType.size() + " columns");
} finally {
closeConnection();
}

setColumns(dbt);

LOGGER.debug("got " + dbt.colsDataType.size() + " columns");

closeConnection();
}

/**
Expand Down Expand Up @@ -768,14 +755,9 @@ private DbTable getTable(String sname, String tableName) {
}

private boolean hasColumns(String schemaName, String tableName) {
DbSchema dbs = getSchema(schemaName);

if (dbs != null) {
DbTable t = dbs.getTable(tableName);

if (t != null) {
return t.hasColumns();
}
DbTable table = getTable(schemaName, tableName);
if (table != null) {
return table.hasColumns();
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/mondrian/gui/PreferencesDialog.java
Expand Up @@ -267,7 +267,7 @@ public void actionPerformed(ActionEvent evt) {
jPanel1.add(selectSchemasButton, gridBagConstraints);

// Disable the select schemas button for now
selectSchemasButton.setEnabled(false);
selectSchemasButton.setVisible(false);

requireSchemaButton.setSelected(false);
gridBagConstraints = new java.awt.GridBagConstraints();
Expand Down
1 change: 1 addition & 0 deletions src/main/mondrian/gui/resources/text.properties
Expand Up @@ -334,6 +334,7 @@ queryPanel.selectedSchema.alert=selected Schema
queryPanel.unsuccessfulConnection.exception=Mondrian connection could not be done for - {0}
preferences.pane.title=Database Connection
preferences.selectSchemasButton.title=Select Schemas
preferences.driverClassName.title=Driver Class Name
preferences.connectionURL.title=Connection URL
preferences.userName.title=User name
Expand Down

0 comments on commit d3a6776

Please sign in to comment.