@@ 422-429 (lines=8) @@ | ||
419 | $selects = ''; |
|
420 | } |
|
421 | ||
422 | if (!$options['count']) { |
|
423 | $distinct = $options['distinct'] ? "DISTINCT" : ""; |
|
424 | $query = "SELECT $distinct e.*{$selects} FROM {$this->CONFIG->dbprefix}entities e "; |
|
425 | } else { |
|
426 | // note: when DISTINCT unneeded, it's slightly faster to compute COUNT(*) than GUIDs |
|
427 | $count_expr = $options['distinct'] ? "DISTINCT e.guid" : "*"; |
|
428 | $query = "SELECT COUNT($count_expr) as total FROM {$this->CONFIG->dbprefix}entities e "; |
|
429 | } |
|
430 | ||
431 | // add joins |
|
432 | foreach ($joins as $j) { |
@@ 388-397 (lines=10) @@ | ||
385 | // remove identical where clauses |
|
386 | $wheres = array_unique($wheres); |
|
387 | ||
388 | if (!$options['count']) { |
|
389 | $distinct = $options['distinct'] ? "DISTINCT" : ""; |
|
390 | ||
391 | $query = "SELECT $distinct rv.* FROM {$CONFIG->dbprefix}river rv "; |
|
392 | } else { |
|
393 | // note: when DISTINCT unneeded, it's slightly faster to compute COUNT(*) than IDs |
|
394 | $count_expr = $options['distinct'] ? "DISTINCT rv.id" : "*"; |
|
395 | ||
396 | $query = "SELECT COUNT($count_expr) as total FROM {$CONFIG->dbprefix}river rv "; |
|
397 | } |
|
398 | ||
399 | // add joins |
|
400 | foreach ($joins as $j) { |