use of net.sourceforge.sqlexplorer.dataset.DataSet in project tdq-studio-se by Talend.
the class AbstractDataSetTab method fillDetailComposite.
public final void fillDetailComposite(Composite composite) {
try {
_composite = composite;
DataSet dataSet = getCachedDataSet();
if (dataSet == null) {
Label label = new Label(composite, SWT.FILL);
label.setText(Messages.getString("DatabaseDetailView.NoInformation"));
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
return;
}
// store for later use in dataset table
// $NON-NLS-1$
composite.setData("IDetailTab", this);
new DataSetTable(composite, dataSet, getStatusMessage());
} catch (Exception e) {
// couldn't get results.. clean mess up
Control[] controls = composite.getChildren();
for (int i = 0; i < controls.length; i++) {
controls[i].dispose();
}
// and show error message
Label label = new Label(composite, SWT.FILL);
// $NON-NLS-2$
label.setText(Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + e.getMessage());
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
SQLExplorerPlugin.error(Messages.getString("AbstractDataSetTab.error"), e);
}
}
use of net.sourceforge.sqlexplorer.dataset.DataSet in project tdq-studio-se by Talend.
the class ImportedKeysTab method getDataSet.
public DataSet getDataSet() throws Exception {
INode node = getNode();
if (node == null) {
return null;
}
if (node instanceof TableNode) {
TableNode tableNode = (TableNode) node;
ResultSet resultSet = node.getSession().getMetaData().getImportedKeys(tableNode.getTableInfo());
DataSet dataSet = new DataSet(resultSet, new int[] { 3, 4, 8, 9, 10, 11, 12, 13, 14 });
resultSet.close();
return dataSet;
}
return null;
}
use of net.sourceforge.sqlexplorer.dataset.DataSet in project tdq-studio-se by Talend.
the class PreviewTab method getDataSet.
public DataSet getDataSet() throws Exception {
INode node = getNode();
if (node == null) {
return null;
}
if (node instanceof TableNode) {
TableNode tableNode = (TableNode) node;
int maxResults = SQLExplorerPlugin.getDefault().getPluginPreferences().getInt(IConstants.PRE_ROW_COUNT);
if (maxResults == 0) {
maxResults = 50;
}
SQLConnection connection = null;
Statement statement = null;
ResultSet resultSet = null;
DataSet dataSet = null;
try {
connection = tableNode.getSession().grabConnection();
statement = connection.createStatement();
statement.setMaxRows(maxResults);
// $NON-NLS-1$
statement.execute("select * from " + tableNode.getQualifiedName());
resultSet = statement.getResultSet();
dataSet = new DataSet(resultSet, null);
} finally {
if (resultSet != null)
try {
resultSet.close();
} catch (SQLException e) {
SQLExplorerPlugin.error(Messages.getString("DataSet.errorCloseRs"), e);
}
if (statement != null)
try {
statement.close();
} catch (SQLException e) {
SQLExplorerPlugin.error(Messages.getString("DataSet.errorCloseStmt"), e);
}
if (connection != null)
getNode().getSession().releaseConnection(connection);
}
return dataSet;
}
return null;
}
use of net.sourceforge.sqlexplorer.dataset.DataSet in project tdq-studio-se by Talend.
the class PrimaryKeysTab method getDataSet.
public DataSet getDataSet() throws Exception {
INode node = getNode();
if (node == null) {
return null;
}
if (node instanceof TableNode) {
TableNode tableNode = (TableNode) node;
ResultSet resultSet = node.getSession().getMetaData().getPrimaryKeys(tableNode.getTableInfo());
DataSet dataSet = new DataSet(resultSet, new int[] { 4, 5, 6 });
resultSet.close();
return dataSet;
}
return null;
}
use of net.sourceforge.sqlexplorer.dataset.DataSet in project tdq-studio-se by Talend.
the class RowCountTab method getDataSet.
public DataSet getDataSet() throws ExplorerException {
String nodeName = getNode().toString();
if (getNode() instanceof TableNode) {
TableNode tableNode = (TableNode) getNode();
nodeName = tableNode.getQualifiedName();
}
try {
// $NON-NLS-1$
return new DataSet(null, "select count(*) from " + nodeName, null, getNode().getSession());
} catch (SQLException e) {
throw new ExplorerException(e);
}
}
Aggregations