All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.bixuebihui.jdbc.IDbHelper Maven / Gradle / Ivy
Go to download
a fast small database connection pool and a active record flavor mini framework
package com.bixuebihui.jdbc;
import javax.validation.constraints.NotNull;
import javax.sql.DataSource;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* IDbHelper interface.
*
* @author xingwx
* @version $Id: $Id
*/
public interface IDbHelper {
/**
* Example: final List names = new LinkedList();
* dbHelper.executeQuery("SELECT user_mc FROM jiao_user", new
* RowCallbackHandler() { public void processRow(ResultSet rs) throws
* SQLException { names.add(rs.getString(1)); };
*
* @param sql
* SQL语句
* @param handle
* 处理接口
*/
void executeQuery(String sql, RowCallbackHandler handle);
/**
* executeQuery.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param handle a {@link RowCallbackHandler} object.
*/
void executeQuery(String sql, Object[] params, RowCallbackHandler handle);
/**
* must change the return value to {@code List> }
*
* @param sql SQL 语句
* @param params SQL 参数
* @return List of Map
*/
List> executeQuery(String sql, Object[] params);
/**
* executeScalar.
*
* @param strSql a {@link java.lang.String} object.
* @return a {@link java.lang.Object} object.
*/
Object executeScalar(String strSql);
/**
* executeScalar.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @return a {@link java.lang.Object} object.
*/
Object executeScalar(String sql, Object[] params);
/**
* executeScalar.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param cn a {@link java.sql.Connection} object.
* @return a {@link java.lang.Object} object.
*/
Object executeScalar(String sql, Object[] params, Connection cn);
/**
* must change the return value to {@code List> }
*
* @param strSql SQL 语句
* @return List of Map
*/
List> exeQuery(String strSql);
/**
* getConnection.
*
* @return a {@link java.sql.Connection} object.
*/
Connection getConnection();
/**
* executeQuery.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param handle a {@link RowMapperResultReader} object.
* @param a T object.
* @return a {@link java.util.List} object.
*/
@NotNull List executeQuery(String sql, Object[] params, RowMapperResultReader handle);
@NotNull List executeQuery(String sql, Object[] params,
@NotNull RowMapperResultReader handle, Set returnFields);
@NotNull List executeQuery(String sql, Object[] params, RowMapper handle);
@NotNull List executeQuery(String sql, Object[] params, RowMapper handle, Set returnFields);
/**
* executeNoQuery.
*
* @param strSql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param cn a {@link java.sql.Connection} object.
* @return a int.
*/
int executeNoQuery(String strSql, Object[] params, Connection cn);
/**
* executeNoQuery.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param targetSqlTypes an array of int.
* @return a int.
*/
int executeNoQuery(String sql, Object[] params, int[] targetSqlTypes);
/**
* executeNoQuery.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @param targetSqlTypes an array of int.
* @param conn a {@link java.sql.Connection} object.
* @return a int.
*/
int executeNoQuery(String sql, Object[] params, int[] targetSqlTypes, Connection conn);
/**
* executeNoQuery.
*
* @param strSql a {@link java.lang.String} object.
* @return a int.
*/
int executeNoQuery(String strSql);
long insertAndFetchLastId(String sql, Object[] params,
int[] targetSqlTypes, Connection conn);
/**
* executeNoQuery.
*
* @param sql a {@link java.lang.String} object.
* @param params an array of {@link java.lang.Object} objects.
* @return a int.
*/
int executeNoQuery(String sql, Object[] params);
/**
* executeNoQuery.
*
* @param strSql an array of {@link java.lang.String} objects.
* @return a int.
*/
int executeNoQuery(String[] strSql);
/**
* executeNoQuery.
*
* @param strSql an array of {@link java.lang.String} objects.
* @param cn a {@link java.sql.Connection} object.
* @return a int.
*/
int executeNoQuery(String[] strSql, Connection cn);
/**
* 批处里数组, 用于Insert, delete或update
*
* @param strSql
* 参数化SQL语句
* @param params
* 参数数组列表
* @param cn
* 数据库连接,如为空,则自动获得
* @return 成功执行数量
*/
int executeNoQueryBatch(String strSql, Iterable params, Connection cn);
/**
* executeNoQueryBatch.
*
* @param strSql a {@link java.lang.String} object.
* @param params a {@link java.lang.Iterable} object.
* @return a int.
*/
int executeNoQueryBatch(String strSql, Iterable params);
/**
* executeNoQueryBatch.
*
* @param strSql a {@link java.lang.String} object.
* @param total a int.
* @param cur a {@link ParamsIterator.CurrentParameters} object.
* @param cn a {@link java.sql.Connection} object.
* @return a int.
*/
int executeNoQueryBatch(String strSql, int total, ParamsIterator.CurrentParameters cur, Connection cn);
/**
* 读写分离的连接获取,readOnly=true for select, readOnly=false for
* update,insert,delete,create, alter etc.
*
* @param readOnly
* readOnly=true for select, readOnly=false for
* update,insert,delete,create, alter etc
* @return 返回只读链接
*/
Connection getConnection(boolean readOnly) ;
DataSource getDataSource();
/**
* setDataSource.
*
* @param connManager a {@link javax.sql.DataSource} object.
*/
void setDataSource(DataSource connManager);
/**
* close.
*
*/
void close() ;
}