当前位置: 首页>>代码示例>>PHP>>正文


PHP Expression::expAnd方法代码示例

本文整理汇总了PHP中Expression::expAnd方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::expAnd方法的具体用法?PHP Expression::expAnd怎么用?PHP Expression::expAnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expression的用法示例。


在下文中一共展示了Expression::expAnd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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))));
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:9,代码来源:OqlSelectClauseTest.class.php

示例2: testPgGeneration

 public function testPgGeneration()
 {
     $dialect = $this->getDbByType('PgSQL')->getDialect();
     $this->assertRegExp('/^\\(\\(\\(\\(\'asdf\' = "b"\\) (AND|and) \\("e" != \\("i" \\/ \'123\'\\)\\) (AND|and) \\(\\(lower\\("a"\\) += +lower\\("b"\\)\\) ((IS TRUE)|(is true))\\) (AND|and) \\("g" = \'12\'\\) (AND|and) \\("j" (BETWEEN|between) \'3\' (AND|and) "p"\\)\\) (OR|or) \\("table"\\."c" ((IS NOT NULL)|(is not null))\\)\\) (AND|and) \\("sometable"\\."a" ((not in)|(NOT IN)) \\(\'q\', \'qwer\', \'xcvzxc\', \'wer\'\\)\\)\\)$/', Expression::expAnd(Expression::expOr(Expression::andBlock(Expression::eq(new DBValue('asdf'), new DBField('b')), Expression::notEq(new DBField('e'), Expression::div(new DBField('i'), new DBValue(123))), Expression::isTrue(Expression::eqLower(new DBField('a'), new DBField('b'))), Expression::eq(new DBField('g'), new DBValue(12)), Expression::between('j', new DBValue(3), new DBField('p'))), Expression::notNull(new DBField('c', 'table'))), Expression::notIn(new DBField('a', 'sometable'), array('q', 'qwer', 'xcvzxc', 'wer')))->toDialectString($dialect));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:5,代码来源:LogicTest.class.php

示例3: logIn

 public function logIn($username, $password)
 {
     return $this->getByLogic(Expression::expAnd(Expression::eq('username', $username), Expression::eq('password', $password)));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:4,代码来源:AdministratorDAO.class.php

示例4: testWhere

 public function testWhere()
 {
     $userId = 1;
     $user = TestUser::create()->setId($userId);
     $this->assertCriteria('from TestUser where id = $1 or id = $2 or $2 = id or $1 = $2', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::eqId('id', $user), Expression::eq('id', $userId)), Expression::eq($userId, 'id')), Expression::eq($userId, $userId))), array(1 => $user, 2 => $userId))->assertCriteria('from TestUser where id = 1 or id >= 1 or id <= 1 or id <> 1 or id != 1', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::eq('id', 1), Expression::gtEq('id', 1)), Expression::ltEq('id', 1)), Expression::notEq('id', 1)), Expression::notEq('id', 1))))->assertCriteria('from TestUser where id = 1 and Name = "some" ' . 'or Name = "any" or id = 1 > 2 = id * 2 + 1', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expAnd(Expression::eq('id', 1), Expression::eq('Name', 'some')), Expression::eq('Name', 'any')), Expression::gt(Expression::eq('id', 1), Expression::eq(2, Expression::add(Expression::mul('id', 2), 1))))))->assertCriteria('from TestUser where (id = 1 and (Name = "some" or Name = "any"))', Criteria::create(TestUser::dao())->add(Expression::expAnd(Expression::eq('id', 1), Expression::expOr(Expression::eq('Name', 'some'), Expression::eq('Name', 'any')))))->assertCriteria('from TestUser where ((Name = "some" or Name = "any")) and (id = 1)', Criteria::create(TestUser::dao())->add(Expression::expAnd(Expression::expOr(Expression::eq('Name', 'some'), Expression::eq('Name', 'any')), Expression::eq('id', 1))))->assertCriteria('from TestUser where (id = 1) != ((1 = id) = (id >= 2))', Criteria::create(TestUser::dao())->add(Expression::notEq(Expression::eq('id', 1), Expression::eq(Expression::eq(1, 'id'), Expression::gtEq('id', 2)))))->assertCriteria('from TestUser where not (not not id = 1 and not id > 1)', Criteria::create(TestUser::dao())->add(Expression::not(Expression::expAnd(Expression::not(Expression::not(Expression::eq('id', 1))), Expression::not(Expression::gt('id', 1))))))->assertCriteria('from TestUser where id is null or id is not null or id is true or id is false', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::isNull('id'), Expression::notNull('id')), Expression::isTrue('id')), Expression::isFalse('id'))))->assertCriteria('from TestUser where id in (1) or id not in (1, "2", $1, true)', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::in('id', array(1)), Expression::notIn('id', array(1, '2', true, true)))), array(1 => true))->assertCriteria('from TestUser where id in ($1)', Criteria::create(TestUser::dao())->add(Expression::in('id', Criteria::create(TestUser::dao())->setProjection(Projection::property('id')))), array(1 => OQL::select('id from TestUser')->toCriteria()))->assertCriteria('from TestUser where id in ($1)', Criteria::create(TestUser::dao())->add(Expression::in('id', array(1, 2))), array(1 => array(1, 2)))->assertCriteria('from TestUser where id like $1 or id not like "Ы%" ' . 'or id ilike $2 or id not ilike "ы%" ' . 'or Name similar to "s" or Name not similar to $3', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::like('id', 'ы'), Expression::notLike('id', 'Ы%')), Expression::ilike('id', 'Ы')), Expression::notIlike('id', 'ы%')), Expression::similar('Name', 's')), Expression::notSimilar('Name', 'S'))), array(1 => 'ы', 2 => 'Ы', 3 => 'S'))->assertCriteria('from TestUser where created between "2008-08-06 10:00" and $1 ' . 'or id between id and 10', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::between('created', '2008-08-06 10:00', SQLFunction::create('now')), Expression::between('id', 'id', 10))), array(1 => SQLFunction::create('now')))->assertCriteria('from TestUser where (2 + -id --1) / 2 = id', Criteria::create(TestUser::dao())->add(Expression::eq(Expression::div(Expression::sub(Expression::add(2, Expression::minus('id')), -1), 2), 'id')), array(1 => 'id'));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:6,代码来源:OqlSelectTest.class.php


注:本文中的Expression::expAnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。