public function testGetStatement3()
 {
     $columns1 = array(0 => 'attendent.id', 1 => 'attendent.img', 2 => 'attendent.name', 3 => 'award.name', 4 => 'award.annotation', 5 => 'activity_mng.attend_date');
     $joinTables1 = array(0 => 'activity_mng', 1 => 'award');
     $this->object->select($columns1, 'attendent')->innerJoin($joinTables1)->joinOn("`award`.`id` = `activity_mng`.`award_id`")->andJoinOn("`attendent`.`id` = `activity_mng`.`attendent_id`")->where("`activity_id` = 5")->andWhere("`award_id` > 0");
     $result = $this->object->getDbComponent()->getStatement();
     $compare = "SELECT attendent.id, attendent.img, attendent.name, award.name, award.annotation, activity_mng.attend_date FROM `attendent` INNER JOIN `activity_mng` INNER JOIN `award` ON `award`.`id` = `activity_mng`.`award_id` AND `attendent`.`id` = `activity_mng`.`attendent_id` WHERE (`activity_id` = 5) AND (`award_id` > 0)";
     $this->assertEquals($compare, $result);
 }
 public function testExecute()
 {
     $this->object->select("*", "activity")->where("id > 2")->andWhere("id < 10");
     $mysqlResult = $this->object->execute();
     $result = mysql_fetch_assoc($mysqlResult);
     $compare = array('id' => 3, 'title' => 'act2');
     $this->assertEquals($compare['id'], $result['id']);
     $this->assertEquals($compare['title'], $result['title']);
 }
Beispiel #3
0
 public function testGetStatement3()
 {
     $columns1 = array(0 => 'attendent.id', 1 => 'attendent.img', 2 => 'attendent.name', 3 => 'award.name', 4 => 'award.annotation', 5 => 'activity_mng.attend_date');
     $joinTables1 = array(0 => 'activity_mng', 1 => 'award');
     $this->object->select($columns1, 'attendent')->innerJoinOn('activity_mng', 'attendent.id = activity_mng.attendent_id')->innerJoinOn('award', 'award.id = activity_mng.award_id')->where("`activity_id` = 5")->andWhere("`award_id` > 0");
     $result = $this->object->getStatement();
     $compare = "SELECT attendent.id, attendent.img, attendent.name, award.name, award.annotation, activity_mng.attend_date FROM attendent INNER JOIN activity_mng ON attendent.id = activity_mng.attendent_id INNER JOIN award ON award.id = activity_mng.award_id WHERE (`activity_id` = 5) AND (`award_id` > 0)";
     $this->assertEquals($compare, $result);
 }
 public function testLimitExecute()
 {
     $this->object->select("*", "activity")->limit(1, 1)->orderBy('id');
     $statement = $this->object->getStatement();
     $compareStatement = "SELECT *  FROM (SELECT *, ROW_NUMBER() OVER ( ORDER BY id) as row FROM  [activity]) a WHERE  (row > 1) and (row <= 2)";
     $this->assertEquals($compareStatement, $statement);
     $result = $this->object->execute();
     $compare = array('id' => 3, 'title' => 'act2');
     $this->assertEquals($compare['id'], $result[0]['id']);
     $this->assertEquals($compare['title'], $result[0]['title']);
 }
Beispiel #5
0
 public function testExecute()
 {
     $this->object->select("*", "activity")->where("id > 2")->andWhere("id <= 3");
     $pdoResult = $this->object->execute();
     $result = NULL;
     $count = 0;
     foreach ($pdoResult as $row) {
         if ($count == 0) {
             $result = $row;
         }
     }
     $compare = array('id' => 3, 'title' => 'act2');
     $this->assertEquals($compare['id'], $result['id']);
     $this->assertEquals($compare['title'], $result['title']);
 }