com.aerospike.jdbc.query.BaseQueryHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aerospike-jdbc Show documentation
Show all versions of aerospike-jdbc Show documentation
A JDBC driver for the Aerospike database
package com.aerospike.jdbc.query;
import com.aerospike.client.Bin;
import com.aerospike.client.IAerospikeClient;
import com.aerospike.client.Value;
import com.aerospike.jdbc.model.AerospikeQuery;
import com.aerospike.jdbc.sql.ListRecordSet;
import java.sql.Statement;
import java.util.List;
import static java.util.Collections.emptyList;
public abstract class BaseQueryHandler implements QueryHandler {
protected final IAerospikeClient client;
protected final Statement statement;
protected BaseQueryHandler(IAerospikeClient client, Statement statement) {
this.client = client;
this.statement = statement;
}
protected Bin[] getBins(AerospikeQuery query) {
List columns = query.getColumns();
Bin[] bins = new Bin[columns.size()];
for (int i = 0; i < columns.size(); i++) {
bins[i] = new Bin(columns.get(i), Value.get(query.getValues().get(i)));
}
return bins;
}
protected ListRecordSet emptyRecordSet(AerospikeQuery query) {
return new ListRecordSet(statement, query.getSchema(), query.getTable(),
emptyList(), emptyList());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy