package com.jqmobile.core.orm; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public interface ORMS { /** * 回调函数,通用get隐藏结果集并替代结果集完成数据封装 */ public static interface ICallBack<D>{ public D get(RsAccessor rs) throws SQLException; } /** * 自定义查询语句 * @param sql 原生sql * @param objs 参数数组 * @return * @throws IllegalAccessException * @throws InstantiationException */ <D> List<D> queryRaw(String sql, Object[] args, ICallBack<D> back) throws SQLException, InstantiationException, IllegalAccessException; /** * @param sql 原生sql * @param startIndex 分页起始行 * @param endIndex 分页大小 * @param args 参数集合 * @param iCallBack 返回值封装 * @return * @throws SQLException * @throws IllegalAccessException * @throws InstantiationException */ <D> List<D> queryRaw(String sql, long startIndex, long endIndex, Object[] args, ICallBack<D> iCallBack) throws SQLException, InstantiationException, IllegalAccessException; /** * @param sql * @param args * @param back * @return * @throws SQLException * @throws IllegalAccessException * @throws InstantiationException */ <D> D queryRawFirst(String sql, Object[] args, ICallBack<D> back) throws SQLException, InstantiationException, IllegalAccessException; /** * 自定义修改语句 * @param sql 原生sql * @param objs 参数数组(此参数需对于数据库参数。如:datetime,在java中用的long型,但在做数据库交互式,传入参数请用Date对象) * @return int 返回响应条数 * @throws SQLException */ int modifyRaw(String sql, Object...args) throws SQLException; /** * 自定义删除语句 * @param sql 原生sql * @param objs 参数数组 * @return int 返回响应条数 * @throws SQLException */ int deleteRaw(String sql, Object...args) throws SQLException; /** * * @return * @throws SQLException */ PreparedStatement getPrepareStatement(String sql) throws SQLException; }