예제 #1
0
 /**
  * @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));
 }
예제 #2
0
 /**
  * @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));
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $strings = array();
     $stringExpressions = $this->parameters[Base::STRINGS_KEY];
     foreach ($stringExpressions as $stringExp) {
         $strings[] = $sqlWalker->walkStringPrimary($stringExp);
     }
     return sprintf('CONCAT_WS(%s, %s)', $sqlWalker->walkStringPrimary($this->parameters[Base::SEPARATOR_KEY]), implode(', ', $strings));
 }
예제 #4
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     //TODO: Use platform to get SQL
     $sql = 'LOCATE(' . $sqlWalker->walkStringPrimary($this->_firstStringPrimary) . ', ' . $sqlWalker->walkStringPrimary($this->_secondStringPrimary);
     if ($this->_simpleArithmeticExpression) {
         $sql .= ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression);
     }
     return $sql . ')';
 }
예제 #5
0
파일: ConcatWs.php 프로젝트: m3uzz/onionfw
 /**
  * {@inheritdoc}
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $strings = array();
     $stringExpressions = $this->parameters['strings'];
     foreach ($stringExpressions as $stringExp) {
         $strings[] = $sqlWalker->walkStringPrimary($stringExp);
     }
     return sprintf('CONCAT_WS(%s, %s)', $sqlWalker->walkStringPrimary($this->parameters['separator']), implode(', ', $strings));
 }
예제 #6
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     return $platform->getConcatExpression($sqlWalker->walkStringPrimary($this->_firstStringPrimary), $sqlWalker->walkStringPrimary($this->_secondStringPrimary));
     /*
             $sql = 'CONCAT(' .
                     $sqlWalker->walkStringPrimary($this->_firstStringPrimary)
                     . ', ' .
                     $sqlWalker->walkStringPrimary($this->_secondStringPrimary)
                     . ')';
             return $sql;*/
 }
 /**
  * @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);
 }
예제 #8
0
 /**
  * {@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);
 }
 /**
  * @param SqlWalker $sqlWalker
  * @return string
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     $args = array();
     foreach ($this->concatExpressions as $expression) {
         $args[] = $sqlWalker->walkStringPrimary($expression);
     }
     return 'CONCAT_WS(' . join(', ', (array) $args) . ')';
 }
예제 #10
0
 /**
  * @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);
 }
예제 #11
0
 /**
  * @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);
 }
예제 #12
0
 /**
  * @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);
 }
예제 #13
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $sql = 'TRIM(';
     if ($this->leading) {
         $sql .= 'LEADING ';
     } else {
         if ($this->trailing) {
             $sql .= 'TRAILING ';
         } else {
             if ($this->both) {
                 $sql .= 'BOTH ';
             }
         }
     }
     if ($this->trimChar) {
         $sql .= $sqlWalker->getConnection()->quote($this->trimChar) . ' ';
     }
     return $sql . 'FROM ' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
 }
예제 #14
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $sql = 'TRIM(';
     if ($this->_leading) {
         $sql .= 'LEADING ';
     } else {
         if ($this->_trailing) {
             $sql .= 'TRAILING ';
         } else {
             if ($this->_both) {
                 $sql .= 'BOTH ';
             }
         }
     }
     if ($this->_trimChar) {
         $sql .= $this->_trimChar . ' ';
     }
     //TODO: quote()
     $sql .= 'FROM ' . $sqlWalker->walkStringPrimary($this->_stringPrimary);
     $sql .= ')';
     return $sql;
 }
예제 #15
0
 public function getSql(SqlWalker $sqlWalker)
 {
     return 'INET_ATON(' . $sqlWalker->walkStringPrimary($this->ip) . ')';
 }
예제 #16
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return $sqlWalker->getConnection()->getDatabasePlatform()->getMd5Expression($sqlWalker->walkStringPrimary($this->stringPrimary));
 }
예제 #17
0
파일: Soundex.php 프로젝트: pscheit/psc-cms
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return $this->fname . '(' . $sqlWalker->walkStringPrimary($this->str) . ')';
 }
예제 #18
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return 'SHA2(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ',' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) . ')';
 }
예제 #19
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return $sqlWalker->getConnection()->getDatabasePlatform()->getLocateExpression($sqlWalker->walkStringPrimary($this->secondStringPrimary), $sqlWalker->walkStringPrimary($this->firstStringPrimary), $this->simpleArithmeticExpression ? $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) : false);
 }
 public function getSql(SqlWalker $sqlWalker)
 {
     return sprintf('12756 * ASIN(SQRT(POWER(SIN(((SELECT `lat` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s) - (SELECT `lat` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s)) * PI()/360), 2) + COS((SELECT `lat` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s) * PI()/180) * COS((SELECT `lat` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s) * PI()/180) * POWER(SIN(((SELECT `lng` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s) - (SELECT `lng` FROM `craue_geo_postalcode` WHERE `country` = %s AND `postal_code` = %s)) *  PI()/360), 2)))', $sqlWalker->walkStringPrimary($this->countryOrigin), $sqlWalker->walkStringPrimary($this->postalCodeOrigin), $sqlWalker->walkStringPrimary($this->countryDestination), $sqlWalker->walkStringPrimary($this->postalCodeDestination), $sqlWalker->walkStringPrimary($this->countryOrigin), $sqlWalker->walkStringPrimary($this->postalCodeOrigin), $sqlWalker->walkStringPrimary($this->countryDestination), $sqlWalker->walkStringPrimary($this->postalCodeDestination), $sqlWalker->walkStringPrimary($this->countryOrigin), $sqlWalker->walkStringPrimary($this->postalCodeOrigin), $sqlWalker->walkStringPrimary($this->countryDestination), $sqlWalker->walkStringPrimary($this->postalCodeDestination));
 }
예제 #21
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $platform = $sqlWalker->getConnection()->getDatabasePlatform();
     return $platform->getConcatExpression($sqlWalker->walkStringPrimary($this->firstStringPrimary), $sqlWalker->walkStringPrimary($this->secondStringPrimary));
 }
예제 #22
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     //TODO: Use platform to get SQL
     return 'LOWER(' . $sqlWalker->walkStringPrimary($this->_stringPrimary) . ')';
 }
예제 #23
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     //TODO: Use platform to get SQL
     return 'LOCATE(' . $sqlWalker->walkStringPrimary($this->firstStringPrimary) . ', ' . $sqlWalker->walkStringPrimary($this->secondStringPrimary) . ($this->simpleArithmeticExpression ? ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) : '') . ')';
 }
예제 #24
0
 public function getSql(SqlWalker $sqlWalker)
 {
     return 'DATE_FORMAT (' . $sqlWalker->walkArithmeticExpression($this->dateExpression) . ',' . $sqlWalker->walkStringPrimary($this->formatChar) . ')';
 }
예제 #25
0
 public function getSql(SqlWalker $sqlWalker)
 {
     $parts = array($sqlWalker->walkArithmeticPrimary($this->dateExpression), $sqlWalker->walkStringPrimary($this->dateFormat));
     return sprintf('DATE_FORMAT(%s)', implode(', ', $parts));
 }
예제 #26
0
 /**
  * {@inheritdoc}
  */
 public function getSql(SqlWalker $sqlWalker)
 {
     return sprintf('CONVERT_TZ(%s, %s, %s)', $sqlWalker->walkArithmeticExpression($this->dateExpression), $sqlWalker->walkStringPrimary($this->fromTz), $sqlWalker->walkStringPrimary($this->toTz));
 }
예제 #27
0
 /**
  * getSql - allows ORM to inject a DATE_FORMAT() statement into an SQL
  * string being constructed
  * 
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  * @return void
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     return 'DATE_FORMAT(' . $sqlWalker->walkArithmeticExpression($this->_sDateExpression) . ',' . $sqlWalker->walkStringPrimary($this->_sFormatChar) . ')';
 }
예제 #28
0
 public function getSql(SqlWalker $sqlWalker)
 {
     $parts = array($sqlWalker->walkArithmeticPrimary($this->dateExpression), $sqlWalker->walkStringPrimary($this->fromTZ), $sqlWalker->walkStringPrimary($this->toTZ));
     return sprintf('CONVERT_TZ(%s)', implode(', ', $parts));
 }
예제 #29
0
 /**
  * @override
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     //TODO: Use platform to get SQL
     $sql = 'SUBSTRING(' . $sqlWalker->walkStringPrimary($this->_stringPrimary) . ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression) . ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression) . ')';
     return $sql;
 }
예제 #30
0
 /**
  * getSql - allows ORM  to inject a DATE_FORMAT() statement into an SQL string being constructed
  *
  * @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
  *
  * @return void
  */
 public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
 {
     $date = $sqlWalker->walkArithmeticExpression($this->dateExpression);
     $format = $sqlWalker->walkStringPrimary($this->formatChar);
     return sprintf('DATE_FORMAT(%s, %s)', $date, $format);
 }