use of org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement in project dbeaver by serge-rider.
the class DB2TriggerDepCache method prepareObjectsStatement.
@Override
protected JDBCStatement prepareObjectsStatement(@NotNull JDBCSession session, @NotNull DB2Trigger db2Trigger) throws SQLException {
final JDBCPreparedStatement dbStat = session.prepareStatement(SQL);
dbStat.setString(1, db2Trigger.getParentObject().getName());
dbStat.setString(2, db2Trigger.getName());
return dbStat;
}
use of org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement in project dbeaver by serge-rider.
the class DB2ViewBaseDepCache method prepareObjectsStatement.
@Override
protected JDBCStatement prepareObjectsStatement(@NotNull JDBCSession session, @NotNull DB2ViewBase db2ViewBase) throws SQLException {
final JDBCPreparedStatement dbStat = session.prepareStatement(SQL);
dbStat.setString(1, db2ViewBase.getParentObject().getName());
dbStat.setString(2, db2ViewBase.getName());
return dbStat;
}
use of org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement in project dbeaver by serge-rider.
the class DB2ViewCache method prepareLookupStatement.
@NotNull
@Override
public JDBCStatement prepareLookupStatement(@NotNull JDBCSession session, @NotNull DB2Schema db2Schema, @Nullable DB2View db2View, @Nullable String db2ViewName) throws SQLException {
if (db2View != null || db2ViewName != null) {
final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_VIEW);
dbStat.setString(1, db2Schema.getName());
dbStat.setString(2, db2View != null ? db2View.getName() : db2ViewName);
return dbStat;
} else {
final JDBCPreparedStatement dbStat = session.prepareStatement(SQL_VIEW_ALL);
dbStat.setString(1, db2Schema.getName());
return dbStat;
}
}
use of org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement in project dbeaver by serge-rider.
the class DB2PlanAnalyser method explain.
// ----------------
// Business Methods
// ----------------
public void explain(JDBCSession session) throws DBCException {
Integer stmtNo = STMT_NO_GEN.incrementAndGet();
String explainStmt = String.format(PT_EXPLAIN, stmtNo, query);
LOG.debug("Schema=" + planTableSchema + " : " + explainStmt);
try {
// Start by cleaning old rows for safety
cleanExplainTables(session, stmtNo, planTableSchema);
// Explain
try (JDBCPreparedStatement dbStat = session.prepareStatement(String.format(PT_EXPLAIN, stmtNo, query))) {
dbStat.execute();
}
// Build Node Structure
try (JDBCPreparedStatement dbStat = session.prepareStatement(String.format(SEL_STMT, planTableSchema))) {
dbStat.setInt(1, stmtNo);
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
dbResult.next();
db2PlanStatement = new DB2PlanStatement(session, dbResult, planTableSchema);
}
}
listNodes = db2PlanStatement.buildNodes();
// Clean afterward
cleanExplainTables(session, stmtNo, planTableSchema);
} catch (SQLException e) {
throw new DBCException(e, session.getDataSource());
}
}
use of org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement in project dbeaver by serge-rider.
the class DB2Utils method getListOfUsableTsForExplain.
// ------------------------
// EXPLAIN
// ------------------------
public static List<String> getListOfUsableTsForExplain(DBRProgressMonitor monitor, JDBCSession session) throws SQLException {
LOG.debug("Get List Of Usable Tablespaces For Explain Tables");
List<String> listTablespaces = new ArrayList<>();
try (JDBCPreparedStatement dbStat = session.prepareStatement(SEL_LIST_TS_EXPLAIN)) {
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
listTablespaces.add(dbResult.getString(1));
}
}
}
return listTablespaces;
}
Aggregations