function restrictionTest()
 {
     $this->assertSQL('where job_id = ceil(asin(sin(0.125)))', 'where job_id = ceiling(asin(sin(0.125)))', 'where job_id = ceil(asin(sin(0.125)))', 'where job_id = php(\'ceil\', php(\'asin\', php(\'sin\', 0.125)))', create(new \rdbms\Criteria())->add(Restrictions::equal('job_id', SQLFunctions::ceil(SQLFunctions::asin(SQLFunctions::sin(0.125))))));
     $this->assertSQL('where job_id = ceil(asin(sin(0.125)))', 'where job_id = ceiling(asin(sin(0.125)))', 'where job_id = ceil(asin(sin(0.125)))', 'where job_id = php(\'ceil\', php(\'asin\', php(\'sin\', 0.125)))', create(new \rdbms\Criteria())->add(Restrictions::equal(Job::column('job_id'), SQLFunctions::ceil(SQLFunctions::asin(SQLFunctions::sin(0.125))))));
 }
 public function testJoinWithProjection()
 {
     $jp = new \rdbms\join\JoinProcessor(Job::getPeer());
     $jp->setFetchModes(array('PersonJob->Department' => 'join'));
     $jp->enterJoinContext();
     $this->assertEquals('select  PersonJob.job_id, PersonJob_Department.department_id from JOBS.job as start, JOBS.Person as PersonJob, JOBS.Department as PersonJob_Department where start.job_id *= PersonJob.job_id and PersonJob.department_id *= PersonJob_Department.department_id and  1 = 1', create(new Criteria())->setFetchmode(\rdbms\join\Fetchmode::join('PersonJob'))->setProjection(\rdbms\criterion\Projections::ProjectionList()->add(Job::column('PersonJob->job_id'))->add(Job::column('PersonJob->Department->department_id')))->getSelectQueryString($this->conn, $this->peer, $jp));
     $jp->leaveJoinContext();
 }
 function withProjectionTest()
 {
     $crit = new \rdbms\Criteria();
     $this->assertClass($crit->withProjection(Projections::property(Job::column('job_id'))), 'rdbms.Criteria');
     $this->assertFalse($crit->isProjection());
     $this->assertTrue($crit->withProjection(Projections::property(Job::column('job_id')))->isProjection());
 }
 public function nonExistantRelative()
 {
     Job::column('NonExistant->person_id');
 }
Exemplo n.º 5
0
 public function executeWithRestriction()
 {
     $this->assertClass(create(new SelectQuery())->withRestriction(Job::column('job_id')->equal(5)), 'rdbms.query.SelectQuery');
 }