/** * Builds a basic SELECT table.* FROM db.table query object (making it easy to * inject joins, where criteria, order by, group by, etc.) * * @return As_SelectQuery * @author Anthony Bush * @since 2008-08-26 * @todo PHP 5.3+: use "static" keyword instead of call_user_func and remove the * parameter requirement (making sure that if called with it, no warnings/notices * are generated; i.e. keep backward compatibility) **/ public static function buildSelectQuery($className) { $tableName = call_user_func(array($className, 'getTableName')); $query = new As_SelectQuery(call_user_func(array($className, 'getDb'))); $query->setSelect('`' . $tableName . '`.*'); $query->setFrom('`' . call_user_func(array($className, 'getDbName')) . '`.`' . $tableName . '`'); return $query; }
/** * Hack for versions of PHP that do not work with clone * * @return As_SelectQuery * @author Anthony Bush * @since 2008-03-17 **/ public function getClone() { $sql = new As_SelectQuery($this->db); $sql->setSelect($this->getSelect()); $sql->setFrom($this->getFrom()); $sql->setWhere($this->getWhere()); $sql->setGroupBy($this->getGroupBy()); $sql->setHaving($this->getHaving()); $sql->setOrderBy($this->getOrderBy()); $sql->setLimit($this->getLimit()); $sql->setOffset($this->getOffset()); return $sql; }