Java Code Examples for com.datastax.driver.core.BoundStatement#getString()

The following examples show how to use com.datastax.driver.core.BoundStatement#getString() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: glowroot   File: CassandraWriteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
private @Nullable String getTransactionType(
        List<ColumnDefinitions.Definition> columnDefinitions, BoundStatement boundStatement) {
    if (columnDefinitions.size() < 2) {
        return currTransactionType.get();
    }
    ColumnDefinitions.Definition columnDefinition = columnDefinitions.get(1);
    String columnDefinitionName = columnDefinition.getName();
    if (columnDefinitionName.equals("transaction_type")) {
        return boundStatement.getString(1);
    } else {
        return currTransactionType.get();
    }
}
 
Example 2
Source Project: glowroot   File: CassandraWriteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
private @Nullable String getTransactionName(
        List<ColumnDefinitions.Definition> columnDefinitions, BoundStatement boundStatement) {
    if (columnDefinitions.size() < 3) {
        return currTransactionName.get();
    }
    ColumnDefinitions.Definition columnDefinition = columnDefinitions.get(2);
    String columnDefinitionName = columnDefinition.getName();
    if (columnDefinitionName.equals("transaction_name")) {
        return boundStatement.getString(2);
    } else {
        return currTransactionName.get();
    }
}
 
Example 3
Source Project: glowroot   File: CassandraWriteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
private static @Nullable String getAgentRollupId(
        List<ColumnDefinitions.Definition> columnDefinitions, BoundStatement boundStatement) {
    ColumnDefinitions.Definition columnDefinition = columnDefinitions.get(0);
    String columnDefinitionName = columnDefinition.getName();
    if (columnDefinitionName.equals("agent_rollup_id")
            || columnDefinitionName.equals("agent_id")
            || columnDefinitionName.equals("agent_rollup")) {
        return boundStatement.getString(0);
    } else {
        return null;
    }
}
 
Example 4
Source Project: glowroot   File: CassandraWriteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
private static int getNumBytes(BoundStatement boundStatement, int i, DataType dataType) {
    switch (dataType.getName()) {
        case VARCHAR:
            String s = boundStatement.getString(i);
            return s == null ? 0 : s.length();
        case BLOB:
            ByteBuffer bb = boundStatement.getBytes(i);
            return bb == null ? 0 : bb.limit();
        default:
            return 0;
    }
}