From 2b8a9b604da2802eba75b8fb87740be49dd7a3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20L=C3=B6f=C3=A5s?= Date: Sat, 23 Jul 2022 20:50:28 +0200 Subject: [PATCH] -- fixed issue with prepared statements and new mysql.data 8 -- fixed issues with initial bibnumbers not being uploaded -- changed logging from hh to HH --- LiveResults.Client/FrmMonitor.cs | 6 ++--- LiveResults.Client/Parsers/OlaParser.cs | 5 ++++- LiveResults.Model/EmmaMysqlClient.cs | 30 +------------------------ 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/LiveResults.Client/FrmMonitor.cs b/LiveResults.Client/FrmMonitor.cs index 2b2c65be..2367dcb7 100644 --- a/LiveResults.Client/FrmMonitor.cs +++ b/LiveResults.Client/FrmMonitor.cs @@ -50,7 +50,7 @@ void m_Parser_OnResult(Result newResult) foreach (EmmaMysqlClient client in m_Clients) { if (!client.IsRunnerAdded(newResult.ID)) - client.AddRunner(new Runner(newResult.ID, newResult.RunnerName, newResult.RunnerClub, newResult.Class)); + client.AddRunner(new Runner(newResult.ID, newResult.RunnerName, newResult.RunnerClub, newResult.Class,null,newResult.bib)); else client.UpdateRunnerInfo(newResult.ID, newResult.RunnerName, newResult.RunnerClub, newResult.Class, null, newResult.bib); @@ -81,7 +81,7 @@ void m_Parser_OnLogMessage(string msg) { listBox1.Invoke(new MethodInvoker(delegate { - listBox1.Items.Insert(0, DateTime.Now.ToString("hh:mm:ss") + " " + msg); + listBox1.Items.Insert(0, DateTime.Now.ToString("HH:mm:ss") + " " + msg); })); } } @@ -128,7 +128,7 @@ void cli_OnLogMessage(string msg) { listBox1.Invoke(new MethodInvoker(delegate { - listBox1.Items.Insert(0, DateTime.Now.ToString("hh:mm:ss") + " " + msg); + listBox1.Items.Insert(0, DateTime.Now.ToString("HH:mm:ss") + " " + msg); })); } } diff --git a/LiveResults.Client/Parsers/OlaParser.cs b/LiveResults.Client/Parsers/OlaParser.cs index 0cb3277a..16327007 100644 --- a/LiveResults.Client/Parsers/OlaParser.cs +++ b/LiveResults.Client/Parsers/OlaParser.cs @@ -160,6 +160,9 @@ private void Run() IDbCommand cmdSplits = m_connection.CreateCommand(); IDbCommand cmdSplitTimes = m_connection.CreateCommand(); cmdSplits.CommandText = splitbaseCommand; + + + IDbDataParameter param = cmd.CreateParameter(); param.ParameterName = "date"; if (m_connection is MySql.Data.MySqlClient.MySqlConnection || m_connection is System.Data.H2.H2Connection) @@ -220,7 +223,7 @@ private void Run() if (!string.IsNullOrEmpty(splitsPaths)) splitsToRead = new List(); - cmd.Prepare(); + reader = cmd.ExecuteReader(); while (reader.Read()) { diff --git a/LiveResults.Model/EmmaMysqlClient.cs b/LiveResults.Model/EmmaMysqlClient.cs index f5b31679..dde37c29 100644 --- a/LiveResults.Model/EmmaMysqlClient.cs +++ b/LiveResults.Model/EmmaMysqlClient.cs @@ -355,35 +355,7 @@ public void Start() } } - /* private void LoadDataForPreviousStages(MySqlCommand cmd) - { - MySqlDataReader reader; - if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["multistage_day1"])) - { - int stageId = Convert.ToInt32(ConfigurationManager.AppSettings["multistage_day1"]); - cmd.CommandText = "select dbid, time, status from results where control = 1000 and tavid = " + stageId; - reader = cmd.ExecuteReader(); - - while (reader.Read()) - { - var dbId = Convert.ToInt32(reader["dbId"]); - int time = Convert.ToInt32(reader["time"]); - int status = Convert.ToInt32(reader["status"]); - m_runnerPreviousDaysTotalTime.Add(dbId, new int[] - { - time, status - }); - - if (m_runners.ContainsKey(dbId)) - { - m_runners[dbId].SetResultFromPreviousDays(time, status); - } - } - reader.Close(); - - } - }*/ - + public void UpdateRunnerInfo(int id, string name, string club, string Class, string sourceId, string bib) { if (m_runners.ContainsKey(id))