本文整理汇总了Java中org.sql2o.ResultSetHandler类的典型用法代码示例。如果您正苦于以下问题:Java ResultSetHandler类的具体用法?Java ResultSetHandler怎么用?Java ResultSetHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultSetHandler类属于org.sql2o包,在下文中一共展示了ResultSetHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPendingTasksByWorkflow
import org.sql2o.ResultSetHandler; //导入依赖的package包/类
@Override
public List<Task> getPendingTasksByWorkflow(String taskDefName, String workflowId) {
return getWithTransaction(connection -> {
String GET_IN_PROGRESS_TASKS_FOR_WORKFLOW =
"SELECT json_data FROM task_in_progress tip INNER JOIN task t ON t.task_id = tip.task_id \n" +
" WHERE task_def_name = :taskDefName AND workflow_id = :workflowId";
ResultSetHandler<Task> resultSetHandler = resultSet -> readValue(resultSet.getString("json_data"), Task.class);
return connection.createQuery(GET_IN_PROGRESS_TASKS_FOR_WORKFLOW)
.addParameter("taskDefName", taskDefName)
.addParameter("workflowId", workflowId)
.executeAndFetch(resultSetHandler);
});
}
示例2: getPendingTasksForTaskType
import org.sql2o.ResultSetHandler; //导入依赖的package包/类
@Override
public List<Task> getPendingTasksForTaskType(String taskName) {
Preconditions.checkNotNull(taskName, "task name cannot be null");
return getWithTransaction(connection -> {
String GET_IN_PROGRESS_TASKS_FOR_TYPE =
"SELECT json_data FROM task_in_progress tip INNER JOIN task t ON t.task_id = tip.task_id WHERE task_def_name = :taskDefName";
ResultSetHandler<Task> resultSetHandler = resultSet -> readValue(resultSet.getString("json_data"), Task.class);
return connection.createQuery(GET_IN_PROGRESS_TASKS_FOR_TYPE).addParameter("taskDefName", taskName).executeAndFetch(resultSetHandler);
});
}
示例3: newResultSetHandler
import org.sql2o.ResultSetHandler; //导入依赖的package包/类
@Override
public ResultSetHandler<T> newResultSetHandler(ResultSetMetaData resultSetMetaData) throws SQLException {
JdbcMapper<T> staticMapper = mapper.getMapper(resultSetMetaData);
return new SfmResultSetHandler<T>(staticMapper);
}
示例4: getTasks
import org.sql2o.ResultSetHandler; //导入依赖的package包/类
private List<Task> getTasks(Connection connection, List<String> taskIds) {
if (taskIds.isEmpty()) return Lists.newArrayList();
String GET_TASKS_FOR_IDS = "SELECT json_data FROM task WHERE task_id IN (%s) AND json_data IS NOT NULL";
String query = generateQueryWithParametersListPlaceholders(GET_TASKS_FOR_IDS, taskIds.size());
ResultSetHandler<Task> resultSetHandler = resultSet -> readValue(resultSet.getString("json_data"), Task.class);
return connection.createQuery(query).withParams(taskIds.toArray()).executeAndFetch(resultSetHandler);
}