Search in sources :

Example 11 with DataSet

use of org.talend.sqlbuilder.dataset.dataset.DataSet in project tdi-studio-se by Talend.

the class RowCountTab method getDataSet.

public DataSet getDataSet() throws Exception {
    String nodeName = getNode().toString();
    INode node = getNode();
    if (node == null) {
        return null;
    }
    if (node.getSession() == null) {
        return null;
    }
    if (node instanceof TableNode) {
        TableNode tableNode = (TableNode) getNode();
        nodeName = tableNode.getQualifiedName();
    }
    //$NON-NLS-1$
    return new DataSet(null, "select count(*) from " + nodeName, null, getNode().getSession().getInteractiveConnection());
}
Also used : INode(org.talend.sqlbuilder.dbstructure.nodes.INode) DataSet(org.talend.sqlbuilder.dataset.dataset.DataSet) TableNode(org.talend.sqlbuilder.dbstructure.nodes.TableNode)

Aggregations

DataSet (org.talend.sqlbuilder.dataset.dataset.DataSet)11 ResultSet (java.sql.ResultSet)8 INode (org.talend.sqlbuilder.dbstructure.nodes.INode)8 TableNode (org.talend.sqlbuilder.dbstructure.nodes.TableNode)7 ITableInfo (net.sourceforge.squirrel_sql.fw.sql.ITableInfo)5 SessionTreeNode (org.talend.sqlbuilder.sessiontree.model.SessionTreeNode)5 Statement (java.sql.Statement)2 DatabaseMetaData (java.sql.DatabaseMetaData)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 SQLConnection (net.sourceforge.squirrel_sql.fw.sql.SQLConnection)1 SQLDatabaseMetaData (net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData)1 GridData (org.eclipse.swt.layout.GridData)1 Label (org.eclipse.swt.widgets.Label)1 DriverShim (org.talend.core.model.metadata.builder.database.DriverShim)1 DataSetTable (org.talend.sqlbuilder.dataset.dataset.DataSetTable)1