|
|
@ -8,9 +8,9 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class MySQL : SQLBase
|
|
|
|
public class MySQL : SQLBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
protected MySqlConnection DBConnection {get;set;}
|
|
|
|
protected MySqlConnection DBConnection { get; set; }
|
|
|
|
protected MySqlCommand DBCommand {get;set;}
|
|
|
|
protected MySqlCommand DBCommand { get; set; }
|
|
|
|
protected MySqlDataReader DBReader {get;set;}
|
|
|
|
protected MySqlDataReader DBReader { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public MySQL(string server, string database, string username, string password)
|
|
|
|
public MySQL(string server, string database, string username, string password)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -34,11 +34,15 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
DBConnection = new MySqlConnection(DBConnectionInfo.GetConnectionString());
|
|
|
|
DBConnection = new MySqlConnection(DBConnectionInfo.GetConnectionString());
|
|
|
|
DBConnection.Open();
|
|
|
|
DBConnection.Open();
|
|
|
|
DBCommand = DBConnection.CreateCommand();
|
|
|
|
DBCommand = DBConnection.CreateCommand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DBCommand.CommandType = CommandType.Text;
|
|
|
|
|
|
|
|
DBCommand.CommandText = "SET character_set_results=utf8mb4";
|
|
|
|
|
|
|
|
DBCommand.ExecuteNonQuery();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void DisposeConnection()
|
|
|
|
protected override void DisposeConnection()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(DBConnection.State == ConnectionState.Open)
|
|
|
|
if (DBConnection.State == ConnectionState.Open)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DBConnection.Close();
|
|
|
|
DBConnection.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -53,7 +57,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int? rv = null;
|
|
|
|
int? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt32(columnID);
|
|
|
|
rv = DBReader.GetInt32(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -70,7 +74,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
byte? rv = null;
|
|
|
|
byte? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetByte(columnID);
|
|
|
|
rv = DBReader.GetByte(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -119,7 +123,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
decimal? rv = null;
|
|
|
|
decimal? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetDecimal(columnID);
|
|
|
|
rv = DBReader.GetDecimal(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -136,7 +140,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
long? rv = null;
|
|
|
|
long? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt64(columnID);
|
|
|
|
rv = DBReader.GetInt64(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,7 +157,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
short? rv = null;
|
|
|
|
short? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt16(columnID);
|
|
|
|
rv = DBReader.GetInt16(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -170,7 +174,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string rv = string.Empty;
|
|
|
|
string rv = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetString(columnID);
|
|
|
|
rv = DBReader.GetString(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -187,7 +191,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool? rv = null;
|
|
|
|
bool? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetBoolean(columnID);
|
|
|
|
rv = DBReader.GetBoolean(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -204,7 +208,7 @@ namespace Common.Library.SQL.MySQL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DateTime? rv = null;
|
|
|
|
DateTime? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = GetDateTime(columnID);
|
|
|
|
rv = GetDateTime(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|