예제 #1
0
 public function Test_of_findBySql()
 {
     $Users = new AkTestUser();
     $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users WHERE first_name = 'Hilario'");
     $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
     $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE first_name = ?", array('Hilario')));
     $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
     $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE first_name = ?", 'Hilario'));
     $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
     $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE last_name = ?", array('last_name' => 'Ferrer Martínez')));
     $this->assertTrue($FoundUsers[0]->first_name == 'Bermi');
     $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE last_name = ? AND first_name = ?", array('Ferrer Martínez', 'Bermi')));
     $this->assertTrue($FoundUsers[0]->first_name == 'Bermi');
     $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users", 6);
     $this->assertEqual(count($FoundUsers), 6);
     $this->assertErrorPattern("/DEPRECATED WARNING.*findBySql.*/");
     $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users", 6, 6);
     $this->assertEqual(count($FoundUsers), 3);
     $this->assertErrorPattern("/DEPRECATED WARNING.*findBySql.*/");
     $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users WHERE iad=123");
     $this->assertEqual(count($FoundUsers), 0);
     $this->assertError();
 }
예제 #2
0
    function Test_of_findBySql()
    {
        $Users = new AkTestUser();
        
        $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users WHERE first_name = 'Hilario'");
        $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
        
        $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE first_name = ?",array('Hilario')));
        $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
        
        $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE first_name = ?",'Hilario'));
        $this->assertTrue($FoundUsers[0]->last_name == 'Hervás Añó');
        
        $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE last_name = ?",array('last_name'=>'Ferrer Martínez')));
        $this->assertTrue($FoundUsers[0]->first_name == 'Bermi');
        
        $FoundUsers = $Users->findBySql(array("SELECT * FROM ak_test_users WHERE last_name = ? AND first_name = ?",array('Ferrer Martínez','Bermi')));
        $this->assertTrue($FoundUsers[0]->first_name == 'Bermi');
        
        $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users",6);
        $this->assertEqual(count($FoundUsers), 6);
        
        $FoundUsers = $Users->findBySql("SELECT * FROM ak_test_users",6,6);
        $this->assertEqual(count($FoundUsers), 3);

    }