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


PHP SqlWalker::walkArithmeticPrimary方法代码示例

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


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

示例1: getSql

 /**
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  *
  * @return string
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     // use second parameter if parsed
     if (null !== $this->fmt) {
         return sprintf('TRUNC(%s, %s)', $sqlWalker->walkArithmeticPrimary($this->date), $sqlWalker->walkArithmeticPrimary($this->fmt));
     }
     return sprintf('TRUNC(%s)', $sqlWalker->walkArithmeticPrimary($this->date));
 }
开发者ID:AlboVieira,项目名称:aplicacaozend,代码行数:13,代码来源:Trunc.php

示例2: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     $p = $sqlWalker->getConnection()->getDatabasePlatform();
     $pi = $p->getPiExpression();
     // %F * ASIN(SQRT(POWER(SIN((%s - %s) * PI()/360), 2) + COS(%s * PI()/180) * COS(%s * PI()/180) * POWER(SIN((%s - %s) * PI()/360), 2)))
     $formula = "%F * ({$pi} / 2 - " . $p->getAcosExpression($p->getSqrtExpression('(' . $p->getSinExpression("(%s - %s)  * {$pi} / 360") . ' * ' . $p->getSinExpression("(%s - %s)  * {$pi} / 360") . ') + (' . $p->getCosExpression("%s * {$pi} / 180") . ' * ' . $p->getCosExpression("%s * {$pi} / 180") . ' * ' . $p->getSinExpression("(%s - %s)  * {$pi} / 360") . ' * ' . $p->getSinExpression("(%s - %s)  * {$pi} / 360") . ')')) . ')';
     return sprintf($formula, Measure::EARTH_RADIUS_KM * 2.0, $sqlWalker->walkArithmeticPrimary($this->latOrigin), $sqlWalker->walkArithmeticPrimary($this->latPoint), $sqlWalker->walkArithmeticPrimary($this->latOrigin), $sqlWalker->walkArithmeticPrimary($this->latPoint), $sqlWalker->walkArithmeticPrimary($this->latOrigin), $sqlWalker->walkArithmeticPrimary($this->latPoint), $sqlWalker->walkArithmeticPrimary($this->lonOrigin), $sqlWalker->walkArithmeticPrimary($this->lonPoint), $sqlWalker->walkArithmeticPrimary($this->lonOrigin), $sqlWalker->walkArithmeticPrimary($this->lonPoint));
 }
开发者ID:mhlavac,项目名称:GeonamesBundle,代码行数:8,代码来源:GeoDistance.php

示例3: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     $args = array_map(function ($value) use($sqlWalker) {
         return $sqlWalker->walkArithmeticPrimary($value);
     }, $this->values);
     return 'GREATEST(' . implode(', ', $args) . ')';
 }
开发者ID:v3labs,项目名称:doctrine-extensions,代码行数:7,代码来源:LeastFunction.php

示例4: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     $args = array_map(function ($value) use($sqlWalker) {
         $nodeSql = $sqlWalker->walkArithmeticPrimary($value);
         return $this->notEmpty ? sprintf("NULLIF(%s, '')", $nodeSql) : $nodeSql;
     }, $this->values);
     return 'CONCAT_WS(' . implode(', ', $args) . ')';
 }
开发者ID:v3labs,项目名称:doctrine-extensions,代码行数:8,代码来源:ConcatWs.php

示例5: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $sql = "WEEK(" . $sqlWalker->walkArithmeticPrimary($this->date);
     if ($this->mode != null) {
         $sql .= ", " . $sqlWalker->walkLiteral($this->mode);
     }
     $sql .= ")";
     return $sql;
 }
开发者ID:uppaljs,项目名称:pakistan-vlmis-v2,代码行数:12,代码来源:Week.php

示例6: getSql

 /**
  * Get sql
  *
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     /*
      * Giving each argument only once and using %1$s, %2$s, ... doesn't work. Would result in:
      * SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
      */
     // formula adapted from http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
     // originally returns distance in miles: 3956 * 2 * ASIN(SQRT(POWER(SIN((orig.lat - dest.lat) * PI()/180 / 2), 2) + COS(orig.lat * PI()/180) * COS(dest.lat * PI()/180) * POWER(SIN((orig.lon - dest.lon) *  PI()/180 / 2), 2)))
     return sprintf('ASIN(SQRT(POWER(SIN((%s - %s) * PI()/360), 2) + COS(%s * PI()/180) * COS(%s * PI()/180) * POWER(SIN((%s - %s) *  PI()/360), 2))) * (%s *2)', $sqlWalker->walkArithmeticPrimary($this->latitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->latitudeDestination), $sqlWalker->walkArithmeticPrimary($this->latitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->latitudeDestination), $sqlWalker->walkArithmeticPrimary($this->longitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->longitudeDestination), $sqlWalker->walkArithmeticPrimary($this->radius));
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:16,代码来源:HaversineFunction.php

示例7: getSql

 /**
  * {@inheritdoc}
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     /*
      * formula adapted from http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
      * originally returns distance in miles: 3956 * 2 * ASIN(SQRT(POWER(SIN((orig.lat - dest.lat) * PI()/180 / 2), 2) + COS(orig.lat * PI()/180) * COS(dest.lat * PI()/180) * POWER(SIN((orig.lon - dest.lon) *  PI()/180 / 2), 2)))
      */
     return sprintf('12756 * ASIN(SQRT(POWER(SIN((%s::numeric - %s::numeric) * PI()/360), 2) + COS(%s::numeric * PI()/180) * COS(%s::numeric * PI()/180) * POWER(SIN((%s::numeric - %s::numeric) *  PI()/360), 2)))', $sqlWalker->walkArithmeticPrimary($this->parameters['latOrigin']), $sqlWalker->walkArithmeticPrimary($this->parameters['latDestination']), $sqlWalker->walkArithmeticPrimary($this->parameters['latOrigin']), $sqlWalker->walkArithmeticPrimary($this->parameters['latDestination']), $sqlWalker->walkArithmeticPrimary($this->parameters['lngOrigin']), $sqlWalker->walkArithmeticPrimary($this->parameters['lngDestination']));
 }
开发者ID:marc-f,项目名称:CraueGeoBundle,代码行数:11,代码来源:GeoDistance.php

示例8: getSql

 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $separator = array_shift($this->values)->simpleArithmeticExpression->value;
     // Create an array to hold the query elements.
     $queryBuilder = array('(');
     // Iterate over the captured expressions and add them to the query.
     for ($i = 0; $i < count($this->values); $i++) {
         if ($i > 0) {
             $queryBuilder[] = " || '{$separator}' || ";
         }
         // Dispatch the walker on the current node.
         $queryBuilder[] = sprintf("IFNULL(%s, '')", $sqlWalker->walkArithmeticPrimary($this->values[$i]));
     }
     // Close the query.
     $queryBuilder[] = ')';
     // Return the joined query.
     return implode('', $queryBuilder);
 }
开发者ID:giuliaries,项目名称:DoctrineExtensions,代码行数:18,代码来源:ConcatWs.php

示例9: getSql

 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     // Create an array to hold the query elements.
     $queryBuilder = array('CONCAT_WS(');
     // Iterate over the captured expressions and add them to the query.
     for ($i = 0; $i < count($this->values); $i++) {
         if ($i > 0) {
             $queryBuilder[] = ', ';
         }
         // Dispatch the walker on the current node.
         $nodeSql = $sqlWalker->walkArithmeticPrimary($this->values[$i]);
         if ($this->notEmpty) {
             // Exclude empty strings from the concatenation.
             $nodeSql = sprintf("NULLIF(%s, '')", $nodeSql);
         }
         $queryBuilder[] = $nodeSql;
     }
     // Close the query.
     $queryBuilder[] = ')';
     // Return the joined query.
     return implode('', $queryBuilder);
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:22,代码来源:ConcatWs.php

示例10: getSql

 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return 'HOUR(' . $sqlWalker->walkArithmeticPrimary($this->date) . ')';
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:4,代码来源:Hour.php

示例11: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     return sprintf('IF(%s, %s, %s)', $sqlWalker->walkConditionalExpression($this->expr[0]), $sqlWalker->walkArithmeticPrimary($this->expr[1]), $sqlWalker->walkArithmeticPrimary($this->expr[2]));
 }
开发者ID:claroline,项目名称:distribution,代码行数:4,代码来源:IfElse.php

示例12: getSql

 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return sprintf('EXTRACT(YEAR FROM %s)', $sqlWalker->walkArithmeticPrimary($this->date));
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:4,代码来源:Year.php

示例13: getSql

 /**
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  *
  * @return string
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return 'SUBTIME(' . $sqlWalker->walkArithmeticPrimary($this->timeExpression) . ',
                     ' . $sqlWalker->walkArithmeticPrimary($this->timeExpression2) . ')';
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:10,代码来源:SubTime.php

示例14: getSql

 /**
  * @param SqlWalker $sqlWalker
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     return "MONTH(" . $sqlWalker->walkArithmeticPrimary($this->date) . ")";
 }
开发者ID:glauberkyves,项目名称:mysql-functions-doctrine2,代码行数:8,代码来源:MysqlMonth.php

示例15: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     return sprintf('%s * ASIN(SQRT(POWER(SIN((%s - %s) * PI()/360), 2) + COS(%s * PI()/180) * COS(%s * PI()/180) * POWER(SIN((%s - %s) *  PI()/360), 2)))', self::EARTH_DIAMETER, $sqlWalker->walkArithmeticPrimary($this->latitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->latitudeDestination), $sqlWalker->walkArithmeticPrimary($this->latitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->latitudeDestination), $sqlWalker->walkArithmeticPrimary($this->longitudeOrigin), $sqlWalker->walkArithmeticPrimary($this->longitudeDestination));
 }
开发者ID:kulishkin,项目名称:gis,代码行数:4,代码来源:Distance.php


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