DIBI syntaxe v Nette Database

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Blujacker
Člen | 89
+
0
-

Zdravim,

so far I've been using dibi but lately, I am trying to switch over to Nette Database. I do like the new syntax (->table()->where…) however for some more complicated queries I still prefer to write the query myself. In dibi, I could use %and which would accept array (even nested arrays) and completed the query. I am struggling to achieve similar behavior with NDB. Is this even supported?

Zatim jsem pouzival dibi ale posledni dobou si vice a vice hraju v Nette a s tim prisla i Nette Database. Ale pro nektere slozitejsi dotazy porad preferuji to napsat sam. V dibi existoval modifikator %and ktery prijimal pole (i vnorene) a dotaz zkompletoval. V Nette database se mi ale nedari dosahnout toho sameho. Neni tato funkcionalita soucasti Nette database nebo delam neco spatne?

$where = array();
$where[] = array("((viewers_bouquets_active_from >= ? and viewers_bouquets_active_from <= ?
    or (viewers_bouquets_active_to >= ? and viewers_bouquets_active_to <= ?)
    or (viewers_bouquets_active_from <= now() and viewers_bouquets_active_to >= now()))", $from, $to, $from, $to);
$where["viewers_bouquets_viewers_id = ?"] = $this->viewers_id;

$query = $this->database->query("SELECT viewers_bouquets_active_from, viewers_bouquets_active_to, viewers_bouquets_subscribed, viewers_bouquets_cancelled, bouquets_name from viewers_bouquets inner join bouquets on viewers_bouquets_bouquets_id = bouquets_id where ?and order by viewers_bouquets_subscribed, bouquets_name, viewers_bouquets_active_from", $where);

Polozil jsem jiz tento dotaz do anglickeho fora, ale to ceske se mi zda daleko aktivnejsi tak treba budu mit vice stesti zde.

Dekuji,
Jakub