當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SqlWalker::getConnection方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Query\SqlWalker::getConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP SqlWalker::getConnection方法的具體用法?PHP SqlWalker::getConnection怎麽用?PHP SqlWalker::getConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Query\SqlWalker的用法示例。


在下文中一共展示了SqlWalker::getConnection方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getSql

 /**
  * {@inheritdoc}
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $stringPrimary = $sqlWalker->walkStringPrimary($this->stringPrimary);
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     $trimMode = $this->getTrimMode();
     $trimChar = $this->trimChar !== false ? $sqlWalker->getConnection()->quote($this->trimChar) : false;
     return $platform->getTrimExpression($stringPrimary, $trimMode, $trimChar);
 }
開發者ID:Dren-x,項目名稱:mobit,代碼行數:11,代碼來源:TrimFunction.php

示例2: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $pos = AbstractPlatform::TRIM_UNSPECIFIED;
     if ($this->leading) {
         $pos = AbstractPlatform::TRIM_LEADING;
     } else {
         if ($this->trailing) {
             $pos = AbstractPlatform::TRIM_TRAILING;
         } else {
             if ($this->both) {
                 $pos = AbstractPlatform::TRIM_BOTH;
             }
         }
     }
     return $sqlWalker->getConnection()->getDatabasePlatform()->getTrimExpression($sqlWalker->walkStringPrimary($this->stringPrimary), $pos, $this->trimChar != false ? $sqlWalker->getConnection()->quote($this->trimChar) : false);
 }
開發者ID:manish436,項目名稱:zform,代碼行數:19,代碼來源:TrimFunction.php

示例3: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     if (!method_exists($platform, 'getStringAgg')) {
         return $sqlWalker->walkStringPrimary($this->firstStringPrimary);
     }
     return $platform->getStringAgg($sqlWalker->walkStringPrimary($this->firstStringPrimary), $sqlWalker->walkStringPrimary($this->secondStringPrimary));
 }
開發者ID:sgdoc,項目名稱:sgdoce-codigo,代碼行數:11,代碼來源:StringAggFunction.php

示例4: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $optionalSecondSimpleArithmeticExpression = null;
     if ($this->secondSimpleArithmeticExpression !== null) {
         $optionalSecondSimpleArithmeticExpression = $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression);
     }
     return $sqlWalker->getConnection()->getDatabasePlatform()->getSubstringExpression($sqlWalker->walkStringPrimary($this->stringPrimary), $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression), $optionalSecondSimpleArithmeticExpression);
 }
開發者ID:yamildiego,項目名稱:JY,代碼行數:11,代碼來源:SubstringFunction.php

示例5: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     $strings = array_map(function ($v) use($sqlWalker) {
         return $sqlWalker->walkStringPrimary($v);
     }, $this->strings);
     return call_user_func_array(array($platform, 'getConcatExpression'), $strings);
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:11,代碼來源:MultiConcatFunction.php

示例6: getSql

 /**
  * @param SqlWalker $sqlWalker
  *
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform());
     if ($this->optionalExpression) {
         return sprintf('%s(%s, %s, %s)', $this->functionName, $this->firstGeomExpression->dispatch($sqlWalker), $this->secondGeomExpression->dispatch($sqlWalker), $this->optionalExpression->dispatch($sqlWalker));
     }
     return sprintf('%s(%s, %s)', $this->functionName, $this->firstGeomExpression->dispatch($sqlWalker), $this->secondGeomExpression->dispatch($sqlWalker));
 }
開發者ID:raketman,項目名稱:doctrine2-spatial,代碼行數:13,代碼來源:AbstractDualGeometryOptionalParameterDQLFunction.php

示例7: getSql

 /**
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     if ($platform instanceof PostgreSqlPlatform) {
         return $this->getPostgreSql($sqlWalker);
     }
     throw new NotImplementedException();
 }
開發者ID:carrooi,項目名稱:doctrine,代碼行數:12,代碼來源:Field.php

示例8: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     if (!method_exists($platform, 'getTranslateExpression')) {
         return $sqlWalker->walkStringPrimary($this->firstStringPrimary);
     }
     return $platform->getTranslateExpression($sqlWalker->walkStringPrimary($this->firstStringPrimary), $sqlWalker->walkStringPrimary($this->stringFrom), $sqlWalker->walkStringPrimary($this->stringTo));
 }
開發者ID:sgdoc,項目名稱:sgdoce-codigo,代碼行數:11,代碼來源:TranslateFunction.php

示例9: 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

示例10: getSql

 public function getSql(SqlWalker $sqlWalker)
 {
     $driver = $sqlWalker->getConnection()->getDriver()->getName();
     if ($driver == 'pdo_sqlite') {
         return sprintf("CAST(STRFTIME('%s', %s) AS INTEGER)", $this->formats[$this->field], $this->source->dispatch($sqlWalker));
     } else {
         return sprintf('EXTRACT(%s FROM %s %s)', $this->field, (string) $this->type, $this->source->dispatch($sqlWalker));
     }
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:9,代碼來源:Extract.php

示例11: getSql

 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     $args = array();
     foreach ($this->concatExpressions as $expression) {
         $args[] = $sqlWalker->walkStringPrimary($expression);
     }
     return call_user_func_array(array($platform, 'getConcatExpression'), $args);
 }
開發者ID:alfredocoj,項目名稱:blogzf2tutorial,代碼行數:12,代碼來源:ConcatFunction.php

示例12: getSql

 /**
  * {@inheritdoc}
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     // This type is defined by ANSI SQL
     $targetType = 'VARCHAR';
     // MySQL needs a CHAR type for string conversion (http://dev.mysql.com/doc/refman/5.7/en/type-conversion.html)
     if ($sqlWalker->getConnection()->getDatabasePlatform()->getName() === 'mysql') {
         $targetType = 'CHAR';
     }
     return 'CAST(' . $sqlWalker->walkSimpleArithmeticExpression($this->stringPrimary) . ' AS ' . $targetType . ')';
 }
開發者ID:robertlemke,項目名稱:neos-development-collection,代碼行數:13,代碼來源:ToStringFunction.php

示例13: getSql

 /**
  * @param SqlWalker $sqlWalker
  *
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform());
     $result = sprintf('%s(%s', $this->functionName, $this->geomExpr[0]->dispatch($sqlWalker));
     for ($i = 1, $size = count($this->geomExpr); $i < $size; $i++) {
         $result .= ', ' . $this->geomExpr[$i]->dispatch($sqlWalker);
     }
     $result .= ')';
     return $result;
 }
開發者ID:peuh,項目名稱:doctrine2-spatial,代碼行數:15,代碼來源:AbstractSpatialDQLFunction.php

示例14: getSql

 /**
  * @param  SqlWalker $sqlWalker
  * @return string
  * @throws QueryException
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     switch ($sqlWalker->getConnection()->getDatabasePlatform()->getName()) {
         case 'postgresql':
             return 'RANDOM()';
         case 'mysql':
             return 'RAND()';
         default:
             throw new QueryException("You can't use RANDOM()!");
     }
 }
開發者ID:remi-san,項目名稱:doctrine-tools,代碼行數:16,代碼來源:Random.php

示例15: getSql

 /**
  * @param SqlWalker $sqlWalker
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $driver = $sqlWalker->getConnection()->getDriver()->getName();
     $translationField = $this->stringField->dispatch($sqlWalker);
     $translationsAlias = explode('.', $translationField)[0];
     $query = $translationField;
     if ($driver == 'pdo_pgsql') {
         $query = "string_agg(DISTINCT " . $translationField . "|| ' [' || " . $translationsAlias . ".locale || '] ', '<br>')";
     }
     return $query;
 }
開發者ID:ojs,項目名稱:ojs,代碼行數:15,代碼來源:TranslationAgg.php


注:本文中的Doctrine\ORM\Query\SqlWalker::getConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。