Bug in Nette\Database (2.0.10, using SQLite)
Notice: This thread is very old.
- Tharos
- Member | 1030
Hi,
I use Nette\Database with SQLite and during one very special situation (that means I'm not able to isolate it easily unfortunately…) I've noticed that Nette\Database is executing a new query for every single pass in foreach loop.
After hours /really! :)/ I've found that on this line I get the same keys but in different order.
This easy hot-fix worked for me (but I didn't take care about performace, you'd probably find out a better one):
if ($referenced !== NULL) {
$a1 = array_keys($keys);
$a2 = array_keys($referenced->rows);
if (!array_diff($a1, $a2) && !array_diff($a2, $a1)) {
return $referenced;
}
}