Bug in Nette\Database (2.0.10, using SQLite)

Notice: This thread is very old.

7 years ago

Tharos
Member | 1042
+
0
-

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;
	}
}

7 years ago

hrach
Member | 1816
+
0
-

Already fixed in master. Initially fixed the same way,later reworked with sort. See github commits.

Last edited by hrach (2013-04-05 09:33)

7 years ago

Tharos
Member | 1042
+
0
-

This was perfectly fast support. :) Thank you.

Last edited by Tharos (2013-04-05 10:24)