本文整理匯總了PHP中DataQuery::sql方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataQuery::sql方法的具體用法?PHP DataQuery::sql怎麽用?PHP DataQuery::sql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataQuery
的用法示例。
在下文中一共展示了DataQuery::sql方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSubgroupHandoff
public function testSubgroupHandoff()
{
$dq = new DataQuery('DataQueryTest_A');
$subDq = $dq->disjunctiveGroup();
$orgDq = clone $dq;
$subDq->sort('"DataQueryTest_A"."Name"');
$orgDq->sort('"DataQueryTest_A"."Name"');
$this->assertEquals($dq->sql(), $orgDq->sql());
$subDq->limit(5, 7);
$orgDq->limit(5, 7);
$this->assertEquals($dq->sql(), $orgDq->sql());
}
示例2: testJoins
/**
* Test the leftJoin() and innerJoin method of the DataQuery object
*/
function testJoins()
{
$dq = new DataQuery('Member');
$dq->innerJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\"");
$this->assertContains("INNER JOIN \"Group_Members\" ON \"Group_Members\".\"MemberID\" = \"Member\".\"ID\"", $dq->sql());
$dq = new DataQuery('Member');
$dq->leftJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\"");
$this->assertContains("LEFT JOIN \"Group_Members\" ON \"Group_Members\".\"MemberID\" = \"Member\".\"ID\"", $dq->sql());
}
示例3: testDistinct
public function testDistinct()
{
$query = new DataQuery('DataQueryTest_E');
$this->assertContains('SELECT DISTINCT', $query->sql($params), 'Query is set as distinct by default');
$query = $query->distinct(false);
$this->assertNotContains('SELECT DISTINCT', $query->sql($params), 'Query does not contain distinct');
$query = $query->distinct(true);
$this->assertContains('SELECT DISTINCT', $query->sql($params), 'Query contains distinct');
}