天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

150 lines
6.2 KiB

namespace Common.Data
{
/// <summary>
/// 功能:数据库操作接口
/// 作者:王昊昇
/// 时间:2012.2.8
/// </summary>
public interface IDataHelper
{
/// <summary>
/// 打开数据连接
/// </summary>
/// <param name="connString">连接字符串</param>
/// <returns></returns>
System.Data.IDbConnection OpenConnection(string connString);
/// <summary>
/// 打开数据连接
/// </summary>
/// <param name="connStrBuilder">连接字符串生成器</param>
/// <returns></returns>
System.Data.IDbConnection OpenConnection(System.Data.Common.DbConnectionStringBuilder connStrBuilder);
/// <summary>
/// 关闭数据连接
/// </summary>
/// <param name="conn">连接对象</param>
void CloseConnection(System.Data.IDbConnection conn);
/// <summary>
/// 执行查询语句
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <returns></returns>
System.Data.IDataReader ExecuteReader(System.Data.IDbConnection conn, string sql);
/// <summary>
/// 执行查询语句
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <returns></returns>
System.Data.IDataReader ExecuteReader(System.Data.IDbConnection conn,
string sql, params System.Data.IDataParameter[] param);
/// <summary>
/// 执行SQL语句,返回影响的记录数
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">SQL语句</param>
/// <param name="param">参数集</param>
/// <returns>影响的记录数</returns>
int ExecuteSql(System.Data.IDbConnection conn, string sql, params System.Data.IDataParameter[] param);
/// <summary>
/// 执行SQL语句,返回影响的记录数
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">SQL语句</param>
/// <returns>影响的记录数</returns>
int ExecuteSql(System.Data.IDbConnection conn, string sql);
/// <summary>
/// 执行多条SQL语句,实现数据库事务。
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="list">多条SQL语句</param>
void ExecuteSqlTran(System.Data.IDbConnection conn, System.Collections.Generic.List<string> list);
/// <summary>
/// 执行多条SQL语句,实现数据库事务。
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="table">SQL语句的哈希表(key为sql语句,value是该语句的IParameter[])</param>
void ExecuteSqlTran(System.Data.IDbConnection conn, System.Collections.Hashtable table);
/// <summary>
/// 执行一条计算查询结果语句,返回查询结果
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">计算查询结果语句</param>
/// <returns>查询结果</returns>
object GetSingle(System.Data.IDbConnection conn, string sql);
/// <summary>
/// 执行一条计算查询结果语句,返回查询结果
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">计算查询结果语句</param>
/// <param name="param">参数集</param>
/// <returns>查询结果</returns>
object GetSingle(System.Data.IDbConnection conn, string sql,
params System.Data.IDataParameter[] param);
/// <summary>
/// 执行查询语句
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <param name="param">参数集</param>
/// <returns>DataSet</returns>
System.Data.DataSet Query(System.Data.IDbConnection conn, string sql,
params System.Data.IDataParameter[] param);
/// <summary>
/// 执行查询语句
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <returns>DataSet</returns>
System.Data.DataSet Query(System.Data.IDbConnection conn, string sql);
/// <summary>
/// 执行查询语句
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <returns></returns>
System.Data.DataTable QueryReturnDataTable(System.Data.IDbConnection conn, string sql);
/// <summary>
/// 执行数据查询
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="sql">查询语句</param>
/// <param name="param">参数</param>
/// <returns>数据表</returns>
System.Data.DataTable QueryReturnDataTable(System.Data.IDbConnection conn, string sql,
params System.Data.IDataParameter[] param);
/// <summary>
/// 分页处理,取DataTable
/// 使用PagingQuery分页存储过程
/// </summary>
/// <param name="conn">连接对象</param>
/// <param name="tableName">表名</param>
/// <param name="keyFieldName">以哪几列作为排序依据,多列以","分隔</param>
/// <param name="columnList">字段列表,取表中的列,以","分隔,取全部数据使用"*"</param>
/// <param name="where">查询条件</param>
/// <param name="orderBy">排序方式</param>
/// <param name="rowsAmountPerPage">每页记录数</param>
/// <param name="pageIndex">指定页索引</param>
/// <param name="pageConut">返回总页数</param>
/// <param name="rowsAffected">返回总记录数</param>
/// <returns></returns>
System.Data.DataTable PagingQuery(System.Data.IDbConnection conn, string tableName, string keyFieldName, string columnList, string where,
OrderBy orderBy, int rowsAmountPerPage, int pageIndex, out int pageConut, out int rowsAffected);
}
}