模块化函数查询我指定的任何表的时间范围(pg_attribute作为字符串输入)
将多个条件链接为where子句中的函数输入,在调用:: regclass之后
在链接的where子句中引用attrelid = _tablename :: regclass
public function retrieveHydratedCategories()
{
$qb = $this->createQueryBuilder('c');
// your other joins and conditions ...
$qb->leftJoin('c.children', 'children')->addSelect('children');
return $qb->getQuery()->getResult();
}
答案 0 :(得分:0)
您必须编写PL / pgSQL函数并使用动态SQL,这与
类似BEGIN
RETURN QUERY EXECUTE format(
'SELECT ... FROM %I '
'WHERE id = $1 '
'AND time > $2 AND time <= $3',
_tablename::text)
USING _id, rngstart, rngend;
END;