function test_mixedAlotPara() { $query = new SQL_Query('table'); $query->addSelect('myPara', 'myPara1'); $query->addSelect(array('myPara2', 'myPara3')); $query->addSelect(array('myPara4')); $query->addSelect('myPara5'); $this->assertEquals(array('myPara', 'myPara1', 'myPara2', 'myPara3', 'myPara4', 'myPara5'), $query->getSelect()); }
function test_slightlyDifferentQueries1() { $query = new SQL_Query('table'); $query->addWhere('1', '<>', '2'); $query->addSelect('id', 'name'); $query1 = $query; $query->resetSelect(); $query->addSelect('name', 'id'); $this->assertFalse($query1->hashKey() == $query->hashKey()); }
function test_selectSomeColsFromOneTable() { $query = new SQL_Query(array('c' => 'city')); $query->addSelect('id'); $query->addSelect('name'); $query->addSelect('phonePrefix AS phonePref'); $query->addSelect('SOME_FUNCTION(name,3,4) AS resultOfSomeFunc'); $ren = new $this->_renderer($query); $this->assertStringEquals('SELECT id , name , phonePrefix AS phonePref , ' . 'SOME_FUNCTION(name,3,4) AS resultOfSomeFunc FROM city c', $ren->render()); }
function test_default() { $query = new SQL_Query('table'); $query->addSelect('myPara'); $query->resetSelect(); $this->assertEquals(array(), $query->getSelect()); }
function test_default() { $query = new SQL_Query('table'); $query->addWhere('1', '<>', '2'); $query->addSelect('id', 'name'); $query->reset(); $this->assertEquals(new SQL_Query('table'), $query); }