Search in sources :

Example 1 with PreparedStatement

use of com.datastax.oss.driver.api.core.cql.PreparedStatement in project zipkin by openzipkin.

the class InternalForTests method writeDependencyLinks.

static void writeDependencyLinks(CassandraStorage storage, List<DependencyLink> links, long midnightUTC) {
    CqlSession session = storage.session();
    PreparedStatement prepared = session.prepare("INSERT INTO " + Schema.TABLE_DEPENDENCY + " (day,parent,child,calls,errors)" + " VALUES (?,?,?,?,?)");
    LocalDate day = Instant.ofEpochMilli(midnightUTC).atZone(ZoneOffset.UTC).toLocalDate();
    for (DependencyLink link : links) {
        int i = 0;
        storage.session().execute(prepared.bind().setLocalDate(i++, day).setString(i++, link.parent()).setString(i++, link.child()).setLong(i++, link.callCount()).setLong(i, link.errorCount()));
    }
}
Also used : PreparedStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement) DependencyLink(zipkin2.DependencyLink) CqlSession(com.datastax.oss.driver.api.core.CqlSession) LocalDate(java.time.LocalDate)

Aggregations

CqlSession (com.datastax.oss.driver.api.core.CqlSession)1 PreparedStatement (com.datastax.oss.driver.api.core.cql.PreparedStatement)1 LocalDate (java.time.LocalDate)1 DependencyLink (zipkin2.DependencyLink)1