Search in sources :

Example 1 with CassandraStatementTask

use of org.thingsboard.server.dao.nosql.CassandraStatementTask in project thingsboard by thingsboard.

the class AbstractBufferedRateExecutor method queryToString.

private String queryToString(AsyncTaskContext<T, V> taskCtx) {
    CassandraStatementTask cassStmtTask = (CassandraStatementTask) taskCtx.getTask();
    if (cassStmtTask.getStatement() instanceof BoundStatement) {
        BoundStatement stmt = (BoundStatement) cassStmtTask.getStatement();
        String query = stmt.getPreparedStatement().getQuery();
        try {
            query = toStringWithValues(stmt, ProtocolVersion.V5);
        } catch (Exception e) {
            log.warn("Can't convert to query with values", e);
        }
        return query;
    } else {
        return "Not Cassandra Statement Task";
    }
}
Also used : CassandraStatementTask(org.thingsboard.server.dao.nosql.CassandraStatementTask) BoundStatement(com.datastax.oss.driver.api.core.cql.BoundStatement) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

BoundStatement (com.datastax.oss.driver.api.core.cql.BoundStatement)1 TimeoutException (java.util.concurrent.TimeoutException)1 CassandraStatementTask (org.thingsboard.server.dao.nosql.CassandraStatementTask)1