本文整理汇总了PHP中Expression::gt方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::gt方法的具体用法?PHP Expression::gt怎么用?PHP Expression::gt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::gt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInsertFromSelect
public function testInsertFromSelect()
{
$dialect = $this->getDbByType('PgSQL')->getDialect();
$select = OSQL::select()->from('test_table2')->get('field3')->get('field_7')->andWhere(Expression::gt('field2', DBValue::create('33')));
$insert = OSQL::insert()->setSelect($select)->into('test_table')->set('field2', 2)->set('field16', 3);
$this->assertEquals($insert->toDialectString($dialect), 'INSERT INTO "test_table" ("field2", "field16") (' . 'SELECT "test_table2"."field3", "test_table2"."field_7" ' . 'FROM "test_table2" WHERE ("field2" > \'33\')' . ')');
}
示例2: testHaving
public function testHaving()
{
$query = OQL::select('from TestUser');
$criteria = Criteria::create(TestUser::dao());
$this->assertCriteria($query->addHaving(OQL::having('id > 0')), $criteria->addProjection(Projection::having(Expression::gt('id', 0))));
$this->assertCriteria($query->addHaving(OQL::having('name is not null and (id <> $1 or id != $2)')->bindNext(4)->bindNext(8)), $criteria->addProjection(Projection::having(Expression::expAnd(Expression::notNull('name'), Expression::expOr(Expression::notEq('id', 4), Expression::notEq('id', 8))))));
$this->assertEquals(OQL::having('id + $15')->bind(15, 16)->toProjection(), Projection::having(Expression::add('id', 16)));
$this->assertCriteria(OQL::select('from TestUser')->addHaving(OQL::having('id = $1')->bindNext(23))->bindNext(42), Criteria::create(TestUser::dao())->addProjection(Projection::having(Expression::eq('id', 42))));
}
示例3: testDialectStringObjects
public function testDialectStringObjects()
{
$criteria = Criteria::create(TestUser::dao())->setProjection(Projection::property('id'))->add(Expression::gt('registered', Date::create('2011-01-01')));
$this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user.id FROM test_user WHERE (test_user.registered > 2011-01-01)');
$criteria = Criteria::create(TestUserWithContactExtended::dao())->setProjection(Projection::property('contactExt.city.id', 'cityId'))->add(Expression::eq('contactExt.city', TestCity::create()->setId(22)));
$this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user_with_contact_extended.city_id AS cityId FROM test_user_with_contact_extended WHERE (test_user_with_contact_extended.city_id = 22)');
$cityList = array(TestCity::create()->setId(3), TestCity::create()->setId(44));
$criteria = Criteria::create(TestUser::dao())->setProjection(Projection::property('id'))->add(Expression::in('city', $cityList));
$this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user.id FROM test_user WHERE (test_user.city_id IN (3, 44))');
}
示例4: down
public static function down(DAOConnected $object, LogicalObject $exp = null)
{
$getMethod = 'get' . ucfirst(self::$property);
Assert::isTrue(method_exists($object, $getMethod));
$oldPosition = $object->{$getMethod}();
$criteria = Criteria::create($object->dao())->add(Expression::gt(self::$property, $oldPosition))->addOrder(OrderBy::create(self::$property)->asc())->setLimit(1);
if ($exp) {
$criteria->add($exp);
}
if ($lowerObject = $criteria->get()) {
DaoUtils::setNullValue(self::$nullValue);
DaoUtils::swap($lowerObject, $object, self::$property);
}
}
示例5: testChainForm
public function testChainForm()
{
$form = Form::create()->add(Primitive::string('a'))->add(Primitive::string('b'))->add(Primitive::integer('c'))->add(Primitive::integer('d'))->add(Primitive::boolean('e'))->add(Primitive::string('f'))->import(array('a' => 'true', 'c' => 123, 'd' => 123));
$andChain = Expression::chain()->expAnd(Expression::expOr(new FormField('a'), Expression::notNull(new FormField('b'))))->expAnd(Expression::eq(new FormField('c'), new FormField('d')))->expAnd(Expression::isFalse(new FormField('e')));
$this->assertTrue($andChain->toBoolean($form));
$form->importMore(array('e' => 'on'));
$this->assertFalse($andChain->toBoolean($form));
$orChain = Expression::chain()->expOr(Expression::eq(new FormField('a'), new FormField('b')))->expOr(Expression::expOr(new FormField('e'), Expression::gt(new FormField('c'), new FormField('d'))))->expOr(Expression::in(new FormField('f'), array('qwer', 'asdf', 'zxcv')));
$form->import(array());
$this->assertFalse($orChain->toBoolean($form));
$form->import(array('e' => '1'));
$this->assertTrue($orChain->toBoolean($form));
$form->import(array('a' => 'asdf', 'b' => 'qwerq', 'c' => '13', 'd' => '1313', 'f' => 'iukj'));
$this->assertFalse($orChain->toBoolean($form));
$form->import(array('c' => '13', 'd' => '12'));
$this->assertTrue($orChain->toBoolean($form));
$form->import(array('f' => 'asdfwer'));
$this->assertFalse($orChain->toBoolean($form));
$form->import(array('f' => 'qwer'));
$this->assertTrue($orChain->toBoolean($form));
}
示例6: testGroupBy
public function testGroupBy()
{
$this->assertCriteria('from TestUser group by id', Criteria::create(TestUser::dao())->setProjection(Projection::group('id')))->assertCriteria('from TestUser group by id, nickname', Criteria::create(TestUser::dao())->setProjection(Projection::chain()->add(Projection::group('id'))->add(Projection::group('nickname'))))->assertCriteria('from TestUser group by id + 1, id / 2', Criteria::create(TestUser::dao())->setProjection(Projection::chain()->add(Projection::group(Expression::add('id', 1)))->add(Projection::group(Expression::div('id', 2)))))->assertCriteria('from TestUser group by id > (1 + id) / 2', Criteria::create(TestUser::dao())->setProjection(Projection::group(Expression::gt('id', Expression::div(Expression::add(1, 'id'), 2)))))->assertCriteria('from TestUser group by $1, $2 - $3', Criteria::create(TestUser::dao())->setProjection(Projection::chain()->add(Projection::group('id'))->add(Projection::group(Expression::sub(SQLFunction::create('rand'), 10)))), array(1 => 'id', 2 => SQLFunction::create('rand'), 3 => 10));
}
示例7: loadNextChunk
private function loadNextChunk($id)
{
Assert::isNotNull($this->dao);
$this->offset = 0;
$criteria = Criteria::create($this->dao);
if ($this->projection) {
$criteria->setProjection($this->projection);
}
$criteria->addOrder($this->keyProperty)->setLimit($this->chunkSize);
if ($id !== null) {
$criteria->add(Expression::gt($this->keyProperty, $id));
}
// preserving memory bloat
$this->dao->dropIdentityMap();
$this->chunk = $criteria->getList();
return $this->chunk;
}