|
|
@ -1,16 +1,15 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Data;
|
|
|
|
using System.Data;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using OSI.API.Business.Database.Base;
|
|
|
|
|
|
|
|
using MySql.Data.MySqlClient;
|
|
|
|
using MySql.Data.MySqlClient;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OSI.API.Business.Database
|
|
|
|
namespace OSI.API.DAL.Base
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -38,7 +37,7 @@ namespace OSI.API.Business.Database
|
|
|
|
|
|
|
|
|
|
|
|
protected override void DisposeConnection()
|
|
|
|
protected override void DisposeConnection()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (DBConnection.State == ConnectionState.Open)
|
|
|
|
if(DBConnection.State == ConnectionState.Open)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DBConnection.Close();
|
|
|
|
DBConnection.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -53,7 +52,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int? rv = null;
|
|
|
|
int? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt32(columnID);
|
|
|
|
rv = DBReader.GetInt32(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -70,7 +69,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
byte? rv = null;
|
|
|
|
byte? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetByte(columnID);
|
|
|
|
rv = DBReader.GetByte(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -104,7 +103,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
decimal? rv = null;
|
|
|
|
decimal? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetDecimal(columnID);
|
|
|
|
rv = DBReader.GetDecimal(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -121,7 +120,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
long? rv = null;
|
|
|
|
long? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt64(columnID);
|
|
|
|
rv = DBReader.GetInt64(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -138,7 +137,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
short? rv = null;
|
|
|
|
short? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetInt16(columnID);
|
|
|
|
rv = DBReader.GetInt16(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -155,7 +154,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string rv = string.Empty;
|
|
|
|
string rv = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetString(columnID);
|
|
|
|
rv = DBReader.GetString(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -172,7 +171,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool? rv = null;
|
|
|
|
bool? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = DBReader.GetBoolean(columnID);
|
|
|
|
rv = DBReader.GetBoolean(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -189,7 +188,7 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DateTime? rv = null;
|
|
|
|
DateTime? rv = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!DBReader.IsDBNull(columnID))
|
|
|
|
if(!DBReader.IsDBNull(columnID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rv = GetDateTime(columnID);
|
|
|
|
rv = GetDateTime(columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -201,5 +200,17 @@ namespace OSI.API.Business.Database
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return GetDateTime(GetOrdinal(columnName));
|
|
|
|
return GetDateTime(GetOrdinal(columnName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//new MySqlParameter("GUID", MySqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, string.Empty, DataRowVersion.Proposed, guid)
|
|
|
|
|
|
|
|
protected MySqlParameter GetParameter(string columnName, MySqlDbType dataType, ParameterDirection direction, object data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected MySqlParameter GetParameter(string columnName, MySqlDbType dataType, int size, ParameterDirection direction, object data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new MySqlParameter(columnName, dataType, size, direction, false, 0, 0, string.Empty, DataRowVersion.Proposed, data);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|