Simplified setup & improved error handling

This commit is contained in:
2016-03-19 21:25:28 +01:00
parent 2ee1087268
commit afa973306d
78 changed files with 1881 additions and 510 deletions
@@ -26,6 +26,7 @@
using System;
using System.Collections.Generic;
using MySql.Data.MySqlClient;
using Ntp.Analyzer.Log;
using Ntp.Analyzer.Objects;
namespace Ntp.Analyzer.Data.Static
@@ -45,7 +46,9 @@ namespace Ntp.Analyzer.Data.Static
/// <param name="peerMapper">Peer mapper.</param>
internal PeerReadingDatabaseMapper (
HostDatabaseMapper hostMapper,
PeerDatabaseMapper peerMapper)
PeerDatabaseMapper peerMapper,
LogBase log)
: base(log)
{
this.hostMapper = hostMapper;
this.peerMapper = peerMapper;
@@ -55,6 +58,29 @@ namespace Ntp.Analyzer.Data.Static
get { return false; }
}
protected override string TableName {
get { return "peerReading"; }
}
protected override string CreateSql {
get {
return
"CREATE TABLE peerReading ( " +
" id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
" time TIMESTAMP NOT NULL, " +
" hostId INT NOT NULL, " +
" peerId INT NOT NULL, " +
" last INT NOT NULL, " +
" reach INT NOT NULL, " +
" delay DOUBLE NOT NULL, " +
" offset DOUBLE NOT NULL, " +
" jitter DOUBLE NOT NULL, " +
" FOREIGN KEY (hostId) REFERENCES host(id), " +
" FOREIGN KEY (peerId) REFERENCES peer(id) " +
") ENGINE=INNODB;";
}
}
private const string selectSql =
"SELECT " +
"id, time, hostId, peerId, last, reach, delay, offset, jitter " +