예제 #1
0
 function test_collateAndDesc()
 {
     $query = new SQL_Query('table');
     // add a collate clause
     // this should become: ORDER BY col COLLATE collate_name ASC, col2
     $query->addOrder(array('col', false, 'col1'));
     $query->addOrder('col2');
     $this->assertEquals(array(array('col', false, 'col1'), array('col2', false)), $query->getOrder());
 }
예제 #2
0
 function test_twoMixedAndCollate()
 {
     $query = new SQL_Query();
     $query->addOrder(array('name', false, 'x'), array('surname', true, 'y'));
     $ren = new $this->_renderer($query);
     $this->assertStringEquals('name COLLATE x, surname COLLATE y DESC', $ren->renderOrder());
 }
예제 #3
0
 function test_default()
 {
     $query = new SQL_Query('table');
     $query->addOrder(array('col', true));
     $query->resetOrder();
     $this->assertEquals(array(), $query->getOrder());
 }
예제 #4
0
 function test_selectWithAllParts()
 {
     $query = new SQL_Query('city');
     $query->addSelect('*', 'name', 'id');
     $query->addDontSelect('name');
     $query->addWhere('id', '<>', 42);
     $query->addOrder(array('country_id', true));
     $query->addGroup('surname');
     $ren = new $this->_renderer($query);
     $this->assertStringEquals('SELECT *,id FROM city ' . 'WHERE id <> 42 GROUP BY surname ORDER BY country_id DESC', $ren->render());
 }