use of com.cubrid.cubridmanager.core.cubrid.table.SchemaProvider in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method openTableDetail.
private void openTableDetail(TableDetailInfo info) {
//if had opend, set it selection
for (CTabItem tabItem : tabFolder.getItems()) {
if (tabItem.getText().equals(info.getTableName())) {
tabFolder.setSelection(tabItem);
return;
}
}
//if a new table info, create a new tab
TableDashboardComposite tableComp = new TableDashboardComposite(tabFolder, SWT.NONE);
tableComp.initialize();
SchemaProvider schemaProvider = new SchemaProvider(database.getDatabaseInfo(), info.getTableName());
SchemaInfo schemaInfo = schemaProvider.getSchema();
if (schemaInfo == null && StringUtil.isNotEmpty(schemaProvider.getErrorMessage())) {
String msg = Messages.bind(Messages.errGetSchemaInfo, info.getTableName());
CommonUITool.openErrorBox(msg);
return;
}
// load table descriptions
// FIXME move this logic to core module
Connection conn = null;
try {
conn = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), true);
IDatabaseSpec dbSpec = database.getDatabaseInfo();
boolean isSchemaCommentInstalled = SchemaCommentHandler.isInstalledMetaTable(dbSpec, conn);
if (schemaInfo != null && isSchemaCommentInstalled) {
Map<String, SchemaComment> comments = SchemaCommentHandler.loadDescription(dbSpec, conn, schemaInfo.getClassname());
SchemaCommentHandler.bindSchemaInfo(comments, schemaInfo);
}
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
} finally {
QueryUtil.freeQuery(conn);
}
tableComp.setInput(schemaInfo, database.getDatabaseInfo(), isSchemaCommentInstalled);
}
use of com.cubrid.cubridmanager.core.cubrid.table.SchemaProvider in project cubrid-manager by CUBRID.
the class DatabaseInfo method getSchemaInfo.
/**
* get a schema object via table name
*
* Note: using delay loading method for large amount number of tables
*
* @param connection
* @param tableName String The table name
* @return SchemaInfo The instance of SchemaInfo
*/
public SchemaInfo getSchemaInfo(Connection connection, String tableName) {
if (StringUtil.isEmpty(tableName)) {
return null;
}
if (schemaMap == null) {
schemaMap = new HashMap<String, SchemaInfo>();
}
SchemaInfo schemaInfo = schemaMap.get(tableName);
if (schemaInfo == null) {
SchemaProvider schemaProvider = new SchemaProvider(this, tableName);
schemaInfo = schemaProvider.getSchema(connection);
if (schemaInfo == null && StringUtil.isNotEmpty(schemaProvider.getErrorMessage())) {
errorMessage = schemaProvider.getErrorMessage();
return null;
} else {
putSchemaInfo(schemaInfo);
}
}
return schemaInfo;
}
use of com.cubrid.cubridmanager.core.cubrid.table.SchemaProvider in project cubrid-manager by CUBRID.
the class DatabaseInfo method getSchemaInfo.
/**
* get a schema object via table name
*
* Note: using delay loading method for large amount number of tables
*
* @param tableName String The table name
* @return SchemaInfo The instance of SchemaInfo
*/
public SchemaInfo getSchemaInfo(String tableName) {
if (StringUtil.isEmpty(tableName)) {
return null;
}
if (null == schemaMap) {
schemaMap = new HashMap<String, SchemaInfo>();
}
SchemaInfo schemaInfo = schemaMap.get(tableName);
if (null == schemaInfo) {
SchemaProvider schemaProvider = new SchemaProvider(this, tableName);
schemaInfo = schemaProvider.getSchema();
if (schemaInfo == null && StringUtil.isNotEmpty(schemaProvider.getErrorMessage())) {
errorMessage = schemaProvider.getErrorMessage();
return null;
} else {
putSchemaInfo(schemaInfo);
}
}
return schemaInfo;
}
Aggregations