#if MySQL
using System;
using System.Data;
using MySql.Data.MySqlClient;
namespace MrWu.DB {
///
/// 存储过程查询键
///
public class MySqlProcedureParameter : IProdureParameter {
MySqlCommand _command;
///
/// 指令
///
public MySqlCommand command {
get => _command;
}
private string _dbName;
///
/// 数据库名称
///
public string dbName {
get => _dbName;
}
///
/// 错误信息
///
public Exception exception {
get;
set;
}
///
/// 是否报错
///
public bool isException {
get {
return exception != null;
}
}
private MySqlProcedureParameter() { }
internal MySqlProcedureParameter(MySqlCommand mysqlcommand,string dbName) {
this._command = mysqlcommand;
this._dbName = dbName;
}
///
/// 释放
///
public void Dispose() {
if (_command != null) {
_command.Dispose();
_command = null;
}
}
}
///
/// 单独设置参数
///
public class MySqlAloneParameter : ISqlAloneParameter {
string _paramname;
///
/// 参数名称
///
public string paramname {
get => _paramname;
}
object _parmavalue;
///
/// 参数值
///
public object paramvalue {
get => _parmavalue;
set => _parmavalue = value;
}
MySqlDbType _type;
///
/// 参数类型
///
public MySqlDbType type {
get => _type;
}
int _valueLength;
///
/// 参数长度
///
public int valueLength {
get => _valueLength;
}
///
/// sql语句单独设置参数
///
/// 参数名称
/// 参数值
/// 参数值的长度
/// 参数类型
public MySqlAloneParameter(string paramname, object paramvalue, int valuelength, MySqlDbType type = MySqlDbType.Binary) {
this._paramname = paramname;
this._parmavalue = paramvalue;
this._valueLength = valuelength;
this._type = type;
}
///
/// Direction
///
public ParameterDirection Direction { get; set; }
}
}
#endif