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