com.aerospike.jdbc.query.QueryPerformer 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
The newest version!
package com.aerospike.jdbc.query;
import com.aerospike.client.IAerospikeClient;
import com.aerospike.jdbc.model.AerospikeQuery;
import com.aerospike.jdbc.model.Pair;
import java.sql.ResultSet;
import java.sql.Statement;
import static com.aerospike.jdbc.util.Constants.UNSUPPORTED_QUERY_TYPE_MESSAGE;
public final class QueryPerformer {
private QueryPerformer() {
}
public static Pair executeQuery(
IAerospikeClient client,
Statement statement,
AerospikeQuery query
) {
QueryHandler queryHandler;
switch (query.getQueryType()) {
case SELECT:
queryHandler = new SelectQueryHandler(client, statement);
return queryHandler.execute(query);
case INSERT:
queryHandler = new InsertQueryHandler(client, statement);
return queryHandler.execute(query);
case UPDATE:
queryHandler = new UpdateQueryHandler(client, statement);
return queryHandler.execute(query);
case DELETE:
queryHandler = new DeleteQueryHandler(client, statement);
return queryHandler.execute(query);
case DROP_TABLE:
queryHandler = new TruncateQueryHandler(client, statement);
return queryHandler.execute(query);
case CREATE_INDEX:
queryHandler = new IndexCreateHandler(client, statement);
return queryHandler.execute(query);
case DROP_INDEX:
queryHandler = new IndexDropHandler(client, statement);
return queryHandler.execute(query);
default:
throw new UnsupportedOperationException(UNSUPPORTED_QUERY_TYPE_MESSAGE);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy