using System.Data;
using System.Xml;
using System.Xml.Linq;
namespace e_suite.Database.Migrator.SqlWrapper;
public interface ISqlWrapper : IDisposable
{
///
/// Name of the stored procedure to call.
/// Note: can use either CommandName or the CommandText, but not both at the same time.
///
string CommandName { get; set; }
///
/// Adhoc SQL text.
/// Note: can use either CommandName or the CommandText, but not both at the same time.
///
string CommandText { get; set; }
void AddParameter(string name, SqlDbType type, object value);
///
/// Adds a new parameter to the stored procedure
///
/// name of the parameter. For example @test the @ symbol is optional
/// database type of the parameter
/// Specifies if this is an input or output parameter
/// actual value for the parameter
void AddParameter(string name, SqlDbType type, ParameterDirection direction, object value);
///
/// Retrieves the current value of a parameter
///
/// name of the parameter that you need the value for
/// either the value of the named parameter, or null if it does not exist
object? GetParamValue(string name);
///
/// Removes all parameters from the internal parameter list.
///
void Clear();
///
/// Execute the stored procedure without the expectation of any result sets being returned.
/// note: output parameters will be set when the method completes.
///
void Execute();
///
/// Retrieves the procedures return value
///
/// the return value from the procedure call
object? GetReturnValue();
///
/// Execute stored procedure with return an XML reader.
///
///
XmlReader ExecuteXmlReader();
///
/// Execute the stored procedure with the result returned as an XmlDocument
///
/// XML document containing the result of the stored procedure call
XmlDocument ExecuteXmlDocument();
///
/// Execute the stored procedure with the result returned as an XDcoument
///
///
XDocument ExecuteXDocument();
IDataReader ExecuteReader();
bool IsDisposed { get; }
int ParamCount { get; }
///
/// Timeout for sql commands. Default is 30 seconds. 0 means no limit.
///
int Timeout { get; set; }
}