27 namespace Ntp.Analyzer.Data.Sql
45 public DateTime? FilterTime {
get;
set; }
51 public Host FilterHost {
get;
set; }
57 public Peer FilterPeer {
get;
set; }
61 string preparedSql = base.PrepareSql(sql).Trim();
63 if (FilterTime == null && FilterHost == null && FilterPeer == null)
66 bool filterAdded =
false;
68 preparedSql +=
" WHERE ";
70 if (FilterTime != null)
72 var time = FilterTime.Value.ToUniversalTime();
74 preparedSql += $
"{datePart} > \'{time.ToString("yyyy-MM-dd HH:mm:ss
")}\'";
78 if (FilterHost != null)
82 preparedSql +=
" AND ";
85 preparedSql += $
"hostId = {FilterHost.Id}";
89 if (FilterPeer == null)
94 preparedSql +=
" AND ";
97 preparedSql += $
"peerId = {FilterPeer.Id}";
OR/M mapper for tables with a large amount of rows.
static SqlDatabaseFactory Instance
Base class for OR/M mappers. Can be used for mapping objects stored in SQL databases.
abstract string DateAddMinutes(string dateColumn, string minuteColumn)
FilteredSqlDatabaseMapper(LogBase log)
override string PrepareSql(string sql)