/** * wrapper around BasicQuery::setOrderBy, which additionally checks if it is allowed, to apply order to the query. * it is allowed only for single-table queries * * @param array $orderlist * @param array $orderdirectionlist * @return void * @throws LogicException */ public function setOrderby(array $orderlist, array $orderdirectionlist = array()) { if (count($this->from) != 1) { throw new LogicException("setOrderby is allowed only in single-table delete queries"); } parent::setOrderby($orderlist, $orderdirectionlist); }
/** * Constructor of INSERT query. * WARNING: INSERT can be applied only to the single table. You can use array as the first parameter of constructor, but it should be array of 1 element * * @param mixed $tables * @param bool $on_duplicate_update * @throws InvalidArgumentException */ public function __construct($tables, $on_duplicate_update = false) { parent::__construct($tables); if (count($this->from) != 1) { throw new InvalidArgumentException('INSERT can be used only on the single table'); } $this->on_duplicate_update = $on_duplicate_update; }
/** * Creates new SELECT-query object. * By default, it is equivalent of "SELECT t0.* FROM t0, t1, t2, tN", where t0-tN are tables given to this constructor * * @param mixed $tables */ public function __construct($tables) { parent::__construct($tables); $this->setSelect(array(new AllFields())); }