Mercurial > hg > release > thermostat-0.11
view storage/core/src/main/java/com/redhat/thermostat/storage/core/PreparedStatement.java @ 1152:4ba43dcff78e
Implement prepared statements (Part 1).
Reviewed-by: ebaron
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-June/007214.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Fri, 28 Jun 2013 15:27:50 +0200 |
parents | |
children |
line wrap: on
line source
package com.redhat.thermostat.storage.core; import com.redhat.thermostat.storage.model.Pojo; /** * A prepared statement. * * @see Statement * @see DataModifyingStatement * @see Storage#prepareStatement(StatementDescriptor) * */ public interface PreparedStatement { void setBoolean(int paramIndex, boolean paramValue); void setLong(int paramIndex, long paramValue); void setInt(int paramIndex, int paramValue); void setString(int paramIndex, String paramValue); void setStringList(int paramIndex, String[] paramValue); /** * Executes a predefined {@link DataModifyingStatement}. * * @return a non-zero error code on failure. Zero otherwise. * * @throws StatementExecutionException * If the prepared statement wasn't valid for execution. */ int execute() throws StatementExecutionException; /** * Executes a predefined {@link Query}. * * @return a {@link Cursor} as a result to the underlying {@link Query} * * @throws StatementExecutionException * If the prepared statement wasn't valid for execution. */ <T extends Pojo> Cursor<T> executeQuery() throws StatementExecutionException; /** * * @return The unique ID of this predefined statement for the underlying * {@link Storage}. */ int getId(); }