Search in sources :

Example 1 with SQLQueryContainer

use of org.jkiss.dbeaver.model.sql.SQLQueryContainer in project dbeaver by serge-rider.

the class ResultSetViewer method getActiveQueryText.

@NotNull
public String getActiveQueryText() {
    DBCStatistics statistics = getModel().getStatistics();
    String queryText = statistics == null ? null : statistics.getQueryText();
    if (queryText == null || queryText.isEmpty()) {
        DBSDataContainer dataContainer = getDataContainer();
        if (dataContainer != null) {
            if (dataContainer instanceof SQLQueryContainer) {
                SQLScriptElement query = ((SQLQueryContainer) dataContainer).getQuery();
                if (query != null) {
                    return query.getText();
                }
            }
            return dataContainer.getName();
        }
        queryText = DEFAULT_QUERY_TEXT;
    }
    return queryText;
}
Also used : SQLQueryContainer(org.jkiss.dbeaver.model.sql.SQLQueryContainer) SQLScriptElement(org.jkiss.dbeaver.model.sql.SQLScriptElement) NotNull(org.jkiss.code.NotNull)

Example 2 with SQLQueryContainer

use of org.jkiss.dbeaver.model.sql.SQLQueryContainer in project dbeaver by dbeaver.

the class ResultSetViewer method getActiveQueryText.

@NotNull
public String getActiveQueryText() {
    DBCStatistics statistics = getModel().getStatistics();
    String queryText = statistics == null ? null : statistics.getQueryText();
    if (queryText == null || queryText.isEmpty()) {
        DBSDataContainer dataContainer = getDataContainer();
        if (dataContainer != null) {
            if (dataContainer instanceof SQLQueryContainer) {
                SQLScriptElement query = ((SQLQueryContainer) dataContainer).getQuery();
                if (query != null) {
                    return query.getText();
                }
            }
            return dataContainer.getName();
        }
        queryText = DEFAULT_QUERY_TEXT;
    }
    return queryText;
}
Also used : SQLQueryContainer(org.jkiss.dbeaver.model.sql.SQLQueryContainer) SQLScriptElement(org.jkiss.dbeaver.model.sql.SQLScriptElement) NotNull(org.jkiss.code.NotNull)

Aggregations

NotNull (org.jkiss.code.NotNull)2 SQLQueryContainer (org.jkiss.dbeaver.model.sql.SQLQueryContainer)2 SQLScriptElement (org.jkiss.dbeaver.model.sql.SQLScriptElement)2