Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/class/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public static function all($_cmd_id, $_startTime = null, $_endTime = null, $_gro
}
$sql = '';
if ($_groupingType == null || strpos($_groupingType, '::') === false) {
$sql .= 'SELECT ' . DB::buildField(__CLASS__);
$sql .= 'SELECT ' . DB::buildField(__CLASS__) . ', a._tableName';
} else {
$goupingTypeDelta = explode('||', $_groupingType);
if (count($goupingTypeDelta) > 1) {
Expand Down Expand Up @@ -414,7 +414,7 @@ public static function all($_cmd_id, $_startTime = null, $_endTime = null, $_gro
}
$sql .= ' FROM (';
}
$sql .= ' (SELECT * from history WHERE value is not null AND cmd_id=:cmd_id ';
$sql .= ' (SELECT *, \'history\' as _tableName from history WHERE value is not null AND cmd_id=:cmd_id ';
if ($_startTime !== null) {
$sql .= ' AND datetime>=:startTime';
}
Expand All @@ -423,7 +423,7 @@ public static function all($_cmd_id, $_startTime = null, $_endTime = null, $_gro
}
$sql .= ') ';
$sql .= ' UNION ALL ';
$sql .= ' (SELECT * from historyArch WHERE value is not null AND cmd_id=:cmd_id ';
$sql .= ' (SELECT *, \'historyArch\' as _tableName from historyArch WHERE value is not null AND cmd_id=:cmd_id ';
if ($_startTime !== null) {
$sql .= ' AND `datetime`>=:startTime';
}
Expand Down Expand Up @@ -477,13 +477,13 @@ public static function all($_cmd_id, $_startTime = null, $_endTime = null, $_gro
'cmd_id' => $_cmd_id,
'startTime' => $_startTime
);
$sql = 'SELECT ' . DB::buildField(__CLASS__);
$sql = 'SELECT ' . DB::buildField(__CLASS__) . ', a._tableName';
$sql .= ' FROM (';
$sql .= ' (SELECT * from history WHERE value is not null AND cmd_id=:cmd_id AND `datetime`<=:startTime';
$sql .= ' (SELECT *, \'history\' as _tableName from history WHERE value is not null AND cmd_id=:cmd_id AND `datetime`<=:startTime';
$sql .= ' ORDER BY datetime DESC LIMIT 1';
$sql .= ') ';
$sql .= ' UNION ALL ';
$sql .= ' (SELECT * from historyArch WHERE value is not null AND cmd_id=:cmd_id AND `datetime`<=:startTime';
$sql .= ' (SELECT *, \'historyArch\' as _tableName from historyArch WHERE value is not null AND cmd_id=:cmd_id AND `datetime`<=:startTime';
$sql .= ' ORDER BY datetime DESC LIMIT 1';
$sql .= ') ';
$sql .= ')a ';
Expand Down
Loading