本文整理汇总了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();
}
示例2: getQuery
/**
* @return \SQLQuery
*/
public function getQuery()
{
$query = parent::getQuery();
$query->setWhere("");
$query->setSelect("*");
$query->setFrom(sprintf("(%s) x", $this->getUnionedQuery()));
return $query;
}
示例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);
}
示例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();
示例5: getQuery
/**
* @return Doctrine\ORM\Query
*/
public function getQuery()
{
return $this->data_source->getQuery();
}
示例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');