本文整理汇总了PHP中Expression::notEq方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::notEq方法的具体用法?PHP Expression::notEq怎么用?PHP Expression::notEq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::notEq方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))));
}
示例2: testQuery
public function testQuery()
{
$query = OSQL::delete()->from('pity_table');
$dialect = ImaginaryDialect::me();
try {
$query->toDialectString($dialect);
$this->fail();
} catch (WrongArgumentException $e) {
/* pass */
}
$query->where(Expression::eq(1, 2));
$this->assertEquals($query->toDialectString($dialect), 'DELETE FROM pity_table WHERE (1 = 2)');
$query->andWhere(Expression::notEq('a', 'b'));
$this->assertEquals($query->toDialectString($dialect), 'DELETE FROM pity_table WHERE (1 = 2) AND (a != b)');
}
示例3: testQuery
public function testQuery()
{
$query = OSQL::delete()->from('pity_table');
$dialect = PostgresDialect::me();
try {
$query->toDialectString($dialect);
$this->fail();
} catch (WrongArgumentException $e) {
/* pass */
}
$query->where(Expression::eq('count', 2));
$this->assertEquals($query->toDialectString($dialect), 'DELETE FROM "pity_table" WHERE ("count" = \'2\')');
$query->andWhere(Expression::notEq('a', '2'));
$this->assertEquals($query->toDialectString($dialect), 'DELETE FROM "pity_table" WHERE ("count" = \'2\') AND ("a" != \'2\')');
}
示例4: 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));
}
示例5: testHaving
public function testHaving()
{
$this->assertCriteria('from TestUser having (2 + -id --1) / 2 = id', Criteria::create(TestUser::dao())->setProjection(Projection::having(Expression::eq(Expression::div(Expression::sub(Expression::add(2, Expression::minus('id')), -1), 2), 'id'))), array(1 => 'id'))->assertCriteria('from TestUser having (id = 1) != ((1 = id) = (id >= 2))', Criteria::create(TestUser::dao())->setProjection(Projection::having(Expression::notEq(Expression::eq('id', 1), Expression::eq(Expression::eq(1, 'id'), Expression::gtEq('id', 2))))))->assertCriteria('from TestUser having $1 = 1', Criteria::create(TestUser::dao())->setProjection(Projection::having(Expression::eq(SQLFunction::create('count', 'id'), 1))), array(1 => SQLFunction::create('count', 'id')));
}