本文整理汇总了PHP中StatementBuilder::Limit方法的典型用法代码示例。如果您正苦于以下问题:PHP StatementBuilder::Limit方法的具体用法?PHP StatementBuilder::Limit怎么用?PHP StatementBuilder::Limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementBuilder
的用法示例。
在下文中一共展示了StatementBuilder::Limit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToStatementIncreaseOffsetWithInitialOffset
/**
* @covers StatementBuilder::ToStatement
* @covers StatementBuilder::IncreaseOffsetBy
*/
public function testToStatementIncreaseOffsetWithInitialOffset()
{
$expectedQueryBefore = 'WHERE a = b ORDER BY a LIMIT 500 OFFSET 10';
$expectedQueryAfter = 'WHERE a = b ORDER BY a LIMIT 500 OFFSET 40';
$statementBuilder = new StatementBuilder();
$statementBuilder->Limit(500)->Offset(10)->Where('a = b')->OrderBy('a');
$this->assertEquals($expectedQueryBefore, $statementBuilder->ToStatement()->query);
$statementBuilder->IncreaseOffsetBy(30);
$this->assertEquals($expectedQueryAfter, $statementBuilder->ToStatement()->query);
}
示例2: testToStatementRemoveLimitAndOffset
/**
* @covers StatementBuilder::ToStatement
* @covers StatementBuilder::RemoveLimitAndOffset
*/
public function testToStatementRemoveLimitAndOffset()
{
$expectedQueryBefore = 'WHERE a = b ORDER BY a LIMIT 500 OFFSET 0';
$expectedQueryAfter = 'WHERE a = b ORDER BY a';
$statementBuilder = new StatementBuilder();
$statementBuilder->Limit(500)->Offset(0)->Where('a = b')->OrderBy('a');
$this->assertEquals($expectedQueryBefore, $statementBuilder->ToStatement()->query);
$statementBuilder->RemoveLimitAndOffset();
$this->assertEquals($expectedQueryAfter, $statementBuilder->ToStatement()->query);
}