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


PHP QueryBuilder::getQuery方法代码示例

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


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

示例1: getBuilder

 /**
  * Get Query Builder object
  *
  * @return EloquentBuilder|QueryBuilder
  */
 public function getBuilder()
 {
     if ($this->isQueryBuilder()) {
         return $this->query;
     }
     return $this->query->getQuery();
 }
开发者ID:Kirylka,项目名称:Scaffold,代码行数:12,代码来源:BaseEngine.php

示例2: getQuery

 /**
  * @return \SQLQuery
  */
 public function getQuery()
 {
     $query = parent::getQuery();
     $query->setWhere("");
     $query->setSelect("*");
     $query->setFrom(sprintf("(%s) x", $this->getUnionedQuery()));
     return $query;
 }
开发者ID:helpfulrobot,项目名称:heyday-silverstripe-querybuilder,代码行数:11,代码来源:UnionQueryBuilder.php

示例3: getQuery

            $sum += $board->cells[$row][$j];
        }
        echo "{$sum}\n";
    }
}
class QueryBuilder
{
    public static function getQuery($queryString)
    {
        $queryParts = explode(" ", $queryString);
        $command = array_shift($queryParts);
        $parameters = $queryParts;
        if ($command == "SetRow") {
            return new QuerySetRow($parameters);
        }
        if ($command == "SetCol") {
            return new QuerySetCol($parameters);
        }
        if ($command == "QueryRow") {
            return new QueryGetRow($parameters);
        }
        if ($command == "QueryCol") {
            return new QueryGetCol($parameters);
        }
    }
}
$board = new Board();
foreach (file($argv[1]) as $line) {
    $query = QueryBuilder::getQuery(trim($line));
    $query->run($board);
}
开发者ID:eandbsoftware,项目名称:CodeEval-1,代码行数:31,代码来源:QueryBoard.php

示例4: getQuery

                foreach ($this->fields as $field) {
                    $select .= "`" . $this->alias('osoby_pozycje', $i) . "`.`" . $field . "` AS '" . $this->alias('osoby_pozycje', $i) . "." . $field . "', ";
                }
                if ($isLast) {
                    $select = substr($select, 0, -2) . " ";
                }
                if (!$isFirst) {
                    $joins .= "LEFT JOIN `" . $this->name('osoby_pozycje') . "` as `" . $this->alias('osoby_pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i - 1) . "`.`pozycja_id` = `" . $this->alias('osoby_pozycje', $i) . "`.`pozycja_id` AND `" . $this->alias('osoby_pozycje', $i) . "`.`deleted` = '0') ";
                    $joins .= "LEFT JOIN `" . $this->name('osoby') . "` as `" . $this->alias('osoby', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i) . "`.`osoba_id` = `" . $this->alias('osoby', $i) . "`.`id`) ";
                }
            } elseif ($type == 'pozycje') {
                $select .= "`" . $this->alias('pozycje', $i) . "`.`id` AS '" . $this->alias('pozycje', $i) . ".id', ";
                $select .= "`" . $this->alias('pozycje', $i) . "`.`nazwa` AS '" . $this->alias('pozycje', $i) . ".nazwa'";
                $select .= $isLast ? " " : ", ";
                $joins .= "LEFT JOIN `" . $this->name('osoby_pozycje') . "` as `" . $this->alias('osoby_pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i - 1) . "`.`osoba_id` = `" . $this->alias('osoby_pozycje', $i) . "`.`osoba_id` AND `" . $this->alias('osoby_pozycje', $i) . "`.`deleted` = '0') ";
                $joins .= "LEFT JOIN `" . $this->name('pozycje') . "` as `" . $this->alias('pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i) . "`.`pozycja_id` = `" . $this->alias('pozycje', $i) . "`.`id`) ";
            }
        }
        $this->query = $select . $from . $joins . $where;
    }
    public function getQuery()
    {
        return $this->query;
    }
}
$depth = 3;
$queryBuilder = new QueryBuilder($depth, $id);
$query = $queryBuilder->getQuery();
$results = $this->DB->selectAssocs($query);
$treeBuilder = new TreeBuilder($results, $id, $depth);
return $treeBuilder->getData();
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:31,代码来源:powiazania.php

示例5: getQuery

 /**
  * @return Doctrine\ORM\Query
  */
 public function getQuery()
 {
     return $this->data_source->getQuery();
 }
开发者ID:romanmatyus,项目名称:datagrid,代码行数:7,代码来源:NextrasDataSource.php

示例6: strtotime

if (!$peregrine->post->isEmpty('before')) {
    $timeInput = $peregrine->post->getQueryString('before');
    if (strpos($timeInput, '-') !== FALSE) {
        $beforeDate = strtotime($peregrine->post->getDate('before', 'Y-m-d H:i:s'));
    } else {
        $timeAgo = $prism->getTimestampFromString($peregrine->post->getAlnum('before'));
        if (!empty($timeAgo)) {
            $beforeDate = strtotime(implode(" ", $timeAgo) . " ago");
        }
    }
    if (!empty($beforeDate)) {
        $qb->where('d.epoch >= "' . $beforeDate . '"');
    }
}
// set a hash of the conditions, to know if the result count has changed
$sql_hash = sha1($qb->getQuery());
// Count total records
// This is much faster than using SQL_CALC_FOUND_ROWS
if ($sql_hash != $peregrine->session->getAlnum('sql_conditions_hash')) {
    $total_results = 0;
    if (!defined('WEB_UI_DEBUG') || defined('WEB_UI_DEBUG') && !WEB_UI_DEBUG) {
        $total_qb = clone $qb;
        $total_qb->select('COUNT(*)');
        $statement = $db->query($total_qb->getQuery());
        while ($row = $statement->fetch()) {
            $total_results = $row[0];
        }
    }
    $_SESSION['sql_conditions_hash'] = $sql_hash;
    $_SESSION['last_query_total_results'] = $total_results;
    $peregrine->refreshCage('session');
开发者ID:Quartzcraft,项目名称:Website,代码行数:31,代码来源:query.php


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