ImportRun: fix problem with some binary checksums

fixes #1556
This commit is contained in:
Thomas Gelf 2018-08-14 09:10:15 +02:00
parent 08c4df9ecc
commit 3c02f7499f
2 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,9 @@ before switching to a new version.
* FIX: Custom Fields attached to a Service Template have not been shown for Apply
Rules whose name matched the Template Name (#1602)
### Import and Sync
* FIX: There was an issue with specific binary checksums on MySQL (#1556)
1.5.0
-----
### Fixed issues

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\Data\Db\DbObject;
use Icinga\Module\Director\Db;
class ImportRun extends DbObject
{
@ -63,6 +64,8 @@ class ImportRun extends DbObject
public function fetchRows($columns, $filter = null, $keys = null)
{
$db = $this->getDb();
/** @var Db $connection */
$connection = $this->getConnection();
$binchecksum = $this->rowset_checksum;
$query = $db->select()->from(
@ -85,7 +88,17 @@ class ImportRun extends DbObject
array('p' => 'imported_property'),
'p.checksum = rp.property_checksum',
array()
)->where('rsr.rowset_checksum = ?', $this->getConnection()->quoteBinary($binchecksum))->order('r.object_name');
)->order('r.object_name');
if ($connection->isMysql()) {
$query->where('rsr.rowset_checksum = :checksum')->bind([
'checksum' => $binchecksum
]);
} else {
$query->where(
'rsr.rowset_checksum = ?',
$connection->quoteBinary($binchecksum)
);
}
if ($columns === null) {
$columns = $this->listColumnNames();