/** * Executes this query on a connection. * @param conn The connection to a database session to execute the query against. * @return The answer to this query. This must be closed by the calling code. */ public Object execute(Connection conn) throws QueryException, TuplesException { if (logger.isDebugEnabled()) logger.debug("Executing query " + toString()); Answer answer = conn.getSession().query(this); if (answer == null) throw new QueryException("Invalid answer received"); if (logger.isDebugEnabled()) logger.debug("Successfully executed query"); // move to the first row answer.beforeFirst(); return answer; }