Java 类com.datastax.driver.core.querybuilder.Select.Selection 实例源码

项目:memnon    文件:CassandraStorage.java   
@SuppressWarnings("rawtypes")
public void delete(String keyspace, String table, JSONArray columns,
        JSONObject where, ConsistencyLevel consistency_level)
        throws MemnonException, IOException {

    Delete.Selection selection = QueryBuilder.delete();
    if (columns == null) {
        selection.all();
    } else {
        Iterator columnIterator = columns.iterator();
        while (columnIterator.hasNext()) {
            selection.column((String) columnIterator.next());
        }
    }

    Delete statement = selection.from(table);
    Iterator whereIterator = where.entrySet().iterator();
    while (whereIterator.hasNext()) {
        Map.Entry pair = (Map.Entry) whereIterator.next();
        Clause clause = QueryBuilder.eq((String) pair.getKey(),
                pair.getValue());
        statement.where(clause);
    }

    executeStatement(keyspace, statement);
}
项目:presto    文件:CassandraCqlUtils.java   
public static Selection select(List<CassandraColumnHandle> columns)
{
    Selection selection = QueryBuilder.select();
    for (CassandraColumnHandle column : columns) {
        selection.column(validColumnName(column.getName()));
    }
    return selection;
}
项目:memnon    文件:CassandraStorage.java   
@SuppressWarnings("rawtypes")
public JSONArray select(String keyspace, String table, JSONArray columns,
        JSONObject where, ConsistencyLevel consistencyLevel)
        throws MemnonException, CharacterCodingException {

    Selection selection = QueryBuilder.select();
    if (columns == null) {
        selection.all();
    } else {
        Iterator columnIterator = columns.iterator();
        while (columnIterator.hasNext()) {
            selection.column((String) columnIterator.next());
        }
    }

    Select statement = selection.from(table);
    Iterator whereIterator = where.entrySet().iterator();
    while (whereIterator.hasNext()) {
        Map.Entry pair = (Map.Entry) whereIterator.next();
        Clause clause = QueryBuilder.eq((String) pair.getKey(),
                pair.getValue());
        statement.where(clause);
    }

    ResultSet results = executeStatement(keyspace, statement);
    return JsonMarshaller.marshallResultSet(results);
}
项目:presto    文件:CassandraCqlUtils.java   
public static Select from(Selection selection, CassandraTableHandle tableHandle)
{
    String schema = validSchemaName(tableHandle.getSchemaName());
    String table = validTableName(tableHandle.getTableName());
    return selection.from(schema, table);
}