mirror of
https://bitbucket.org/anguist/ntpa
synced 2026-10-11 14:55:00 +00:00
Simplified setup & improved error handling
This commit is contained in:
@@ -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 " +
|
||||
|
||||
Reference in New Issue
Block a user