Search in sources :

Example 21 with NotNull

use of org.jkiss.code.NotNull in project dbeaver by serge-rider.

the class DB2MaterializedQueryTableCache method prepareLookupStatement.

@NotNull
@Override
public JDBCStatement prepareLookupStatement(@NotNull JDBCSession session, @NotNull DB2Schema db2Schema, DB2MaterializedQueryTable db2MaterializedQueryTable, String db2MaterializedQueryTableName) throws SQLException {
    if (db2MaterializedQueryTable != null || db2MaterializedQueryTableName != null) {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_MQT);
        dbStat.setString(1, db2Schema.getName());
        dbStat.setString(2, db2MaterializedQueryTable != null ? db2MaterializedQueryTable.getName() : db2MaterializedQueryTableName);
        return dbStat;
    } else {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_MQT_ALL);
        dbStat.setString(1, db2Schema.getName());
        return dbStat;
    }
}
Also used : JDBCPreparedStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement) NotNull(org.jkiss.code.NotNull)

Example 22 with NotNull

use of org.jkiss.code.NotNull in project dbeaver by serge-rider.

the class DB2NicknameCache method prepareLookupStatement.

@NotNull
@Override
public JDBCStatement prepareLookupStatement(@NotNull JDBCSession session, @NotNull DB2Schema db2Schema, DB2Nickname db2Nickname, String db2NicknameName) throws SQLException {
    if (db2Nickname != null || db2NicknameName != null) {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_NICK);
        dbStat.setString(1, db2Schema.getName());
        dbStat.setString(2, db2Nickname != null ? db2Nickname.getName() : db2NicknameName);
        return dbStat;
    } else {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_NICK_ALL);
        dbStat.setString(1, db2Schema.getName());
        return dbStat;
    }
}
Also used : JDBCPreparedStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement) NotNull(org.jkiss.code.NotNull)

Example 23 with NotNull

use of org.jkiss.code.NotNull in project dbeaver by serge-rider.

the class DB2TableCache method prepareLookupStatement.

@NotNull
@Override
public JDBCStatement prepareLookupStatement(@NotNull JDBCSession session, @NotNull DB2Schema db2Schema, @Nullable DB2Table db2Table, @Nullable String db2TableName) throws SQLException {
    if (db2Table != null || db2TableName != null) {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_TAB);
        dbStat.setString(1, db2Schema.getName());
        dbStat.setString(2, db2Table != null ? db2Table.getName() : db2TableName);
        return dbStat;
    } else {
        final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_TAB_ALL);
        dbStat.setString(1, db2Schema.getName());
        return dbStat;
    }
}
Also used : JDBCPreparedStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement) NotNull(org.jkiss.code.NotNull)

Example 24 with NotNull

use of org.jkiss.code.NotNull in project dbeaver by serge-rider.

the class DB2TableCheckConstraintCache method prepareObjectsStatement.

@NotNull
@Override
protected JDBCStatement prepareObjectsStatement(JDBCSession session, DB2Schema db2Schema, DB2Table forTable) throws SQLException {
    String sql;
    if (forTable != null) {
        sql = SQL_CK_TAB;
    } else {
        sql = SQL_CK_ALL;
    }
    JDBCPreparedStatement dbStat = session.prepareStatement(sql);
    dbStat.setString(1, db2Schema.getName());
    if (forTable != null) {
        dbStat.setString(2, forTable.getName());
    }
    return dbStat;
}
Also used : JDBCPreparedStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement) NotNull(org.jkiss.code.NotNull)

Example 25 with NotNull

use of org.jkiss.code.NotNull in project dbeaver by serge-rider.

the class DB2TableReferenceCache method prepareObjectsStatement.

@NotNull
@Override
protected JDBCStatement prepareObjectsStatement(JDBCSession session, DB2Schema db2Schema, DB2Table forTable) throws SQLException {
    String sql;
    if (forTable != null) {
        sql = SQL_REF_TAB;
    } else {
        sql = SQL_REF_ALL;
    }
    JDBCPreparedStatement dbStat = session.prepareStatement(sql);
    dbStat.setString(1, db2Schema.getName());
    if (forTable != null) {
        dbStat.setString(2, forTable.getName());
    }
    return dbStat;
}
Also used : JDBCPreparedStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement) NotNull(org.jkiss.code.NotNull)

Aggregations

NotNull (org.jkiss.code.NotNull)58 JDBCPreparedStatement (org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement)11 SQLException (java.sql.SQLException)9 DBCException (org.jkiss.dbeaver.model.exec.DBCException)9 DBException (org.jkiss.dbeaver.DBException)7 JDBCStatement (org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement)7 DBCResultSet (org.jkiss.dbeaver.model.exec.DBCResultSet)6 ArrayList (java.util.ArrayList)5 Tree (org.eclipse.swt.widgets.Tree)5 TreeColumn (org.eclipse.swt.widgets.TreeColumn)5 TreeItem (org.eclipse.swt.widgets.TreeItem)5 Nullable (org.jkiss.code.Nullable)5 DBCStatement (org.jkiss.dbeaver.model.exec.DBCStatement)5 JDBCSession (org.jkiss.dbeaver.model.exec.jdbc.JDBCSession)5 DBRProgressMonitor (org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)5 DBSTypedObject (org.jkiss.dbeaver.model.struct.DBSTypedObject)5 SQLScriptStatusDialog (org.jkiss.dbeaver.ui.dialogs.sql.SQLScriptStatusDialog)4 DBDValueHandler (org.jkiss.dbeaver.model.data.DBDValueHandler)3 SQLDataSource (org.jkiss.dbeaver.model.sql.SQLDataSource)3 SQLDialect (org.jkiss.dbeaver.model.sql.SQLDialect)3