Import: avoid stream resources for PostgreSQL

I'd like to change this back to binary data later on, but for now
the fix should be fine.

fixes #11321
This commit is contained in:
Thomas Gelf 2016-03-14 12:07:57 +01:00
parent 077d46d7dd
commit b4ed770651
1 changed files with 11 additions and 4 deletions

View File

@ -413,19 +413,26 @@ class Import
//
// $query = $db->select()->from($table, 'checksum')
// ->where('checksum IN (?)', $checksums)
// ...
// return array_diff($checksums, $existing);
$hexed = array_map('Icinga\Module\Director\Util::binary2hex', $checksums);
$conn = $this->connection;
$query = $db
->select()
->from($table, 'checksum')
->where(
$this->connection->dbHexFunc('checksum') . ' IN (?)',
->from(
$table,
array('checksum' => $conn->dbHexFunc('checksum'))
)->where(
$conn->dbHexFunc('checksum') . ' IN (?)',
$hexed
);
$existing = $db->fetchCol($query);
$new = array_diff($hexed, $existing);
return array_diff($checksums, $existing);
return array_map('Icinga\Module\Director\Util::hex2binary', $new);
}
/**