Search in sources :

Example 1 with GetSchemaTask

use of com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask in project cubrid-manager by CUBRID.

the class SchemaProvider method getSchema.

/**
	 * Retrieves the schema of database object.
	 * 
	 * @return schema of table.
	 */
public SchemaInfo getSchema() {
    GetSchemaTask jdbcTask = new GetSchemaTask(dbInfo, tableName);
    jdbcTask.execute();
    errorMessage = jdbcTask.getErrorMsg();
    return jdbcTask.getSchema();
}
Also used : GetSchemaTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask)

Example 2 with GetSchemaTask

use of com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask in project cubrid-manager by CUBRID.

the class SchemaProvider method getSchema.

/**
	 * Retrieves the schema of database object.
	 * 
	 * @return schema of table.
	 */
public SchemaInfo getSchema(Connection connection) {
    GetSchemaTask jdbcTask = new GetSchemaTask(connection, dbInfo, tableName);
    jdbcTask.execute();
    errorMessage = jdbcTask.getErrorMsg();
    return jdbcTask.getSchema();
}
Also used : GetSchemaTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask)

Example 3 with GetSchemaTask

use of com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask in project cubrid-manager by CUBRID.

the class ColumnProposalAdvisor method loadProposal.

/**
	 * Load proposal for table
	 * 
	 * @param databaseInfo
	 * @param tableName
	 * @param proposal
	 */
private void loadProposal(final DatabaseInfo databaseInfo, final String tableName, final ColumnProposal proposal) {
    Job job = new Job("Load schema information job") {

        protected IStatus run(IProgressMonitor monitor) {
            LOGGER.info("Load table info in ColumnProposalHandler");
            GetSchemaTask getSchemaTask = null;
            try {
                getSchemaTask = new GetSchemaTask(databaseInfo, tableName, monitor);
                getSchemaTask.setNeedCollationInfo(false);
                getSchemaTask.execute();
                if (getSchemaTask.isSuccess()) {
                    SchemaInfo schemaInfo = getSchemaTask.getSchema();
                    if (schemaInfo != null) {
                        List<ColumnProposalDetailInfo> columnList = new ArrayList<ColumnProposalDetailInfo>();
                        for (DBAttribute attr : schemaInfo.getAttributes()) {
                            columnList.add(new ColumnProposalDetailInfo(schemaInfo, attr));
                        }
                        proposal.addSchemaInfo(tableName, schemaInfo, columnList);
                    }
                }
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            } finally {
                getSchemaTask.finish();
            }
            return Status.OK_STATUS;
        }
    };
    job.schedule();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) ArrayList(java.util.ArrayList) Job(org.eclipse.core.runtime.jobs.Job) GetSchemaTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Aggregations

GetSchemaTask (com.cubrid.cubridmanager.core.cubrid.table.task.GetSchemaTask)3 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)1 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 ArrayList (java.util.ArrayList)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1