|
@@ -222,6 +222,11 @@ public class ConnectionLogdbService : IConnectionLogdbService
|
|
|
times.Add(watch.ElapsedMilliseconds);
|
|
|
var tableName = GetTableName(workTime);
|
|
|
|
|
|
+ string withHourIndexCommand = $"""
|
|
|
+ INSERT INTO {tableName} (CreatedOn, ChargeBoxId, MessageType, Data, Msg, IsSent, EVSEEndPoint, Session, HourIndex)
|
|
|
+ VALUES (@CreatedOn, @ChargeBoxId, @MessageType, @Data, @Msg, @IsSent, @EVSEEndPoint, @Session, @HourIndex);
|
|
|
+ """;
|
|
|
+
|
|
|
string command = $"""
|
|
|
INSERT INTO {tableName} (CreatedOn, ChargeBoxId, MessageType, Data, Msg, IsSent, EVSEEndPoint, Session)
|
|
|
VALUES (@CreatedOn, @ChargeBoxId, @MessageType, @Data, @Msg, @IsSent, @EVSEEndPoint, @Session);
|
|
@@ -238,10 +243,18 @@ public class ConnectionLogdbService : IConnectionLogdbService
|
|
|
parameters.Add("IsSent", log.isSent, DbType.Boolean);
|
|
|
parameters.Add("EVSEEndPoint", log.clientData.Endpoint == null ? "123" : log.clientData.Endpoint.ToString(), DbType.String, size: 25);
|
|
|
parameters.Add("Session", log.clientData.SessionID == null ? "123" : log.clientData.SessionID, DbType.String, size: 36);
|
|
|
+ parameters.Add("HourIndex", workTime.Hour, DbType.Int32);
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ await sqlConnection.ExecuteAsync(withHourIndexCommand, parameters);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ logger.LogInformation("Connection Log insert with HourIndex failed, insert without HourIndex");
|
|
|
+ await sqlConnection.ExecuteAsync(command, parameters);
|
|
|
+ }
|
|
|
|
|
|
- await sqlConnection.ExecuteAsync(command, parameters
|
|
|
- //, trans
|
|
|
- );
|
|
|
bundleHandlerData.AddCompletedData(log);
|
|
|
}
|
|
|
|