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') // $query = $db->select()->from($table, 'checksum')
// ->where('checksum IN (?)', $checksums) // ->where('checksum IN (?)', $checksums)
// ...
// return array_diff($checksums, $existing);
$hexed = array_map('Icinga\Module\Director\Util::binary2hex', $checksums); $hexed = array_map('Icinga\Module\Director\Util::binary2hex', $checksums);
$conn = $this->connection;
$query = $db $query = $db
->select() ->select()
->from($table, 'checksum') ->from(
->where( $table,
$this->connection->dbHexFunc('checksum') . ' IN (?)', array('checksum' => $conn->dbHexFunc('checksum'))
)->where(
$conn->dbHexFunc('checksum') . ' IN (?)',
$hexed $hexed
); );
$existing = $db->fetchCol($query); $existing = $db->fetchCol($query);
$new = array_diff($hexed, $existing);
return array_diff($checksums, $existing); return array_map('Icinga\Module\Director\Util::hex2binary', $new);
} }
/** /**