/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:IDBTransaction.cs * 2.功能描述:带有事物的数据库连接 * 编辑履历: * 作者 日期 版本 修改内容 * 张国印 2014/09/01 1.00 新建 *******************************************************************************/ using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; namespace Dongke.IBOSS.PRD.Basics.DataAccess { /// /// 带有事物的数据库连接 /// public interface IDBTransaction { /// /// 事务是否自动提交 /// bool AutoCommit { get; set; } /// /// 数据库连接状态 /// ConnectionState ConnState { get; } /// /// 对应的数据库连接串信息 /// string ConnStr { get; } /// /// 数据库连接对象 /// IDbConnection DbConnection { get; set; } /// /// 忽略大小写 /// bool IgnoreCase { get; set; } /// /// SQL执行限定超时 /// bool IsCommandTimeout { get; set; } /// /// 连接数据库 /// /// 返回连接状态 ConnectionState Connect(); /// /// 启动数据库事务 /// /// 返回是否成功 bool CreateTransaction(); /// /// 注销数据库连接 /// /// 返回连接状态 ConnectionState Disconnect(); /// /// 提交事务 /// void Commit(); /// /// 回滚事务 /// void Rollback(); void RollbackTo(string p_strcheckPoint); /// /// 设置某个时间点的数据库操作 该功能没有实现 /// /// 时间点名称 void SavePoint(string p_strcheckPoint); /// /// 返回一个DataSet数据集合 /// /// 对应的SQL语句 /// 返回一个DataSet数据集合 DataSet GetSqlResultToDs(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 返回一个自定名称的DataSet数据集合 /// /// 对应的SQL语句 /// 返回一个自定名称的DataSet数据集合 DataSet GetSqlResultToDs(string p_strCommand, string p_strName, IDataParameter[] p_Parameter = null); /// /// 执行对应的Sql语句,返回一个数据表 /// /// 要执行的SQL语句 /// 返回对应的数据表 DataTable GetSqlResultToDt(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 执行对应的Sql语句,返回一个字符串 /// /// 要执行的SQL语句 /// 返回对应的一个字符串 string GetSqlResultToStr(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 执行对应的Sql语句,返回一个object /// /// 要执行的SQL语句 /// 返回对应的一个object object GetSqlResultToObj(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 执行对应的SQL语句,返回对应的二进制流信息 /// /// 要执行的SQL语句 /// 返回对应的二进制流信息 byte[] GetSqlResultToBt(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 执行对应的SQL语句,并返回受影响的数据行数 /// /// 对应的SQL语句 /// 受影响的数据行数 int ExecuteNonQuery(string p_strCommand, IDataParameter[] p_Parameter = null); /// /// 执行对应的SQL语句,返回受影响的数据行数 /// /// SQL语句 /// 类型 TRUE是存储过程 False普通SQL语句 /// 受影响的数据行数 int ExecuteNonQuery(string p_strCommand, bool p_procedure, IDataParameter[] p_Parameter = null); /// /// 更新对应的二进制字段的值 /// /// 数据表名称 /// 数据列名称 /// 对应的二进制值 /// 对应的条件 /// 返回状态 0为失败 1为成功 int UpdateBlob(string p_strTable, string p_strColumn, byte[] p_blobData, string p_strWhere); /// /// 执行存储过程 /// /// 存储过程名称 /// IDataParameter类型 参数集合 /// DataSet ExecStoredProcedure(string p_strCommand, IDataParameter[] p_Parameter = null); } }