本文整理汇总了PHP中QueryBuilder::getSQLParts方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::getSQLParts方法的具体用法?PHP QueryBuilder::getSQLParts怎么用?PHP QueryBuilder::getSQLParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::getSQLParts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: merge
/**
* Merge to
* @param QueryBuilder $qb
*/
public function merge(QueryBuilder $qb)
{
$parts = $qb->getSQLParts();
//print_r($parts);exit;
/*'select' => array(),
'from' => array(),
'join' => array(),
'set' => array(),
'where' => null,
'groupBy' => array(),
'having' => null,
'orderBy' => array(),
'limit' => null*/
foreach ($parts['select'] as $select) {
$this->add("select", $select, true);
}
foreach ($parts['from'] as $from) {
$this->add("from", $from, true);
}
foreach ($parts['join'] as $join) {
$this->add("join", $join, true);
}
foreach ($parts['set'] as $set) {
$this->add("set", $set, true);
}
$this->andWhere($parts['where']);
foreach ($parts['groupBy'] as $groupBy) {
$this->add("groupBy", $groupBy, true);
}
if (isset($parts['having']) and is_array($parts['having'])) {
foreach ($parts['having'] as $having) {
$this->add("having", $having, true);
}
}
foreach ($parts['orderBy'] as $orderBy) {
$this->add("orderBy", $orderBy, true);
}
$this->add("limit", $parts['limit'], false);
}