本文整理汇总了PHP中SQLQuery::reverseOrderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQuery::reverseOrderBy方法的具体用法?PHP SQLQuery::reverseOrderBy怎么用?PHP SQLQuery::reverseOrderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLQuery
的用法示例。
在下文中一共展示了SQLQuery::reverseOrderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reverseSort
/**
* Reverse order by clause
*
* @return DataQuery
*/
public function reverseSort()
{
$this->query->reverseOrderBy();
return $this;
}
示例2: testReverseOrderBy
public function testReverseOrderBy()
{
$query = new SQLQuery();
$query->setFrom('MyTable');
// default is ASC
$query->setOrderBy("Name");
$query->reverseOrderBy();
$this->assertEquals('SELECT * FROM MyTable ORDER BY Name DESC', $query->sql());
$query->setOrderBy("Name DESC");
$query->reverseOrderBy();
$this->assertEquals('SELECT * FROM MyTable ORDER BY Name ASC', $query->sql());
$query->setOrderBy(array("Name" => "ASC"));
$query->reverseOrderBy();
$this->assertEquals('SELECT * FROM MyTable ORDER BY Name DESC', $query->sql());
$query->setOrderBy(array("Name" => 'DESC', 'Color' => 'asc'));
$query->reverseOrderBy();
$this->assertEquals('SELECT * FROM MyTable ORDER BY Name ASC, Color DESC', $query->sql());
$query->setOrderBy('implode("MyName","Color") DESC');
$query->reverseOrderBy();
$this->assertEquals('SELECT *, implode("MyName","Color") AS "_SortColumn0" FROM MyTable ORDER BY "_SortColumn0" ASC', $query->sql());
}