Sync up with changes from ARM64

This commit is contained in:
2025-05-01 14:08:33 -04:00
parent 148c236af2
commit c0384feb95
40 changed files with 494 additions and 365 deletions

View File

@@ -3,6 +3,7 @@ using System.Text;
using MySql.Data.MySqlClient;
using MarketData.MarketDataModel;
using MarketData.Utils;
using System.Collections.Generic;
namespace MarketData.DataAccess
{
@@ -69,6 +70,55 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static Dictionary<String,CompanyProfile> GetCompanyProfiles(List<String> symbols)
{
Dictionary<String,CompanyProfile> companyProfiles=new Dictionary<String,CompanyProfile>();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
String strQuery = null;
try
{
StringBuilder sb = new StringBuilder();
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
sb.Append("select sm.symbol,sm.sector,sm.industry,sm.security_type,sm.company,cp.description,cp.pricing_source,cp.can_roll_previous,cp.freeze_pricing from securitymaster sm left outer join companyprofile cp on sm.symbol=cp.symbol").Append(" ");
sb.Append("where sm.symbol in ").Append(SqlUtils.CreateInClause(symbols));
strQuery = sb.ToString();
sqlCommand = new MySqlCommand(strQuery, sqlConnection);
sqlCommand.CommandTimeout = SqlUtils.COMMAND_TIMEOUT;
sqlDataReader = sqlCommand.ExecuteReader();
while(sqlDataReader.Read())
{
CompanyProfile companyProfile = new CompanyProfile();
companyProfile.Symbol=sqlDataReader.GetString(0);
if (!sqlDataReader.IsDBNull(1)) companyProfile.Sector = sqlDataReader.GetString(1);
if (!sqlDataReader.IsDBNull(2)) companyProfile.Industry = sqlDataReader.GetString(2);
if (!sqlDataReader.IsDBNull(3)) companyProfile.SecurityType = sqlDataReader.GetString(3);
if (!sqlDataReader.IsDBNull(4)) companyProfile.CompanyName = sqlDataReader.GetString(4);
if (!sqlDataReader.IsDBNull(5)) companyProfile.Description = sqlDataReader.GetString(5);
if (!sqlDataReader.IsDBNull(6)) companyProfile.PricingSource = sqlDataReader.GetString(6).ToUpper();
if (!sqlDataReader.IsDBNull(7)) companyProfile.CanRollPrevious = sqlDataReader.GetBoolean(7);
if (!sqlDataReader.IsDBNull(8)) companyProfile.FreezePricing = sqlDataReader.GetBoolean(8);
if(!companyProfiles.ContainsKey(companyProfile.Symbol))companyProfiles.Add(companyProfile.Symbol, companyProfile);
}
return companyProfiles;
}
catch (Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,exception);
return null;
}
finally
{
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
}
}
public static CompanyProfiles GetCompanyProfiles()
{
CompanyProfiles companyProfiles=new CompanyProfiles();
@@ -110,10 +160,11 @@ namespace MarketData.DataAccess
finally
{
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) sqlDataReader.Close();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
}
}
public static CompanyProfile GetCompanyProfile(String symbol)
{
MySqlConnection sqlConnection = null;
@@ -152,7 +203,7 @@ namespace MarketData.DataAccess
finally
{
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) sqlDataReader.Close();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
}
}
@@ -187,6 +238,7 @@ namespace MarketData.DataAccess
if(null!=sqlDataReader){sqlDataReader.Close();sqlDataReader.Dispose();}
}
}
private static bool InsertCompanyProfileDescription(CompanyProfile companyProfile,MySqlConnection sqlConnection,MySqlTransaction sqlTransaction)
{
MySqlCommand sqlCommand=null;
@@ -216,6 +268,7 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
}
}
private static bool UpdateCompanyProfileDescription(CompanyProfile companyProfile,MySqlConnection sqlConnection,MySqlTransaction sqlTransaction)
{
MySqlCommand sqlCommand=null;