%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/ppaobm/vendor/yiisoft/yii2/db/pgsql/ |
Upload File : |
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\db\pgsql;
use yii\db\ArrayExpression;
use yii\db\ExpressionBuilderInterface;
use yii\db\ExpressionBuilderTrait;
use yii\db\ExpressionInterface;
use yii\db\JsonExpression;
use yii\db\Query;
use yii\helpers\Json;
/**
* Class JsonExpressionBuilder builds [[JsonExpression]] for PostgreSQL DBMS.
*
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
* @since 2.0.14
*/
class JsonExpressionBuilder implements ExpressionBuilderInterface
{
use ExpressionBuilderTrait;
/**
* {@inheritdoc}
* @param JsonExpression|ExpressionInterface $expression the expression to be built
*/
public function build(ExpressionInterface $expression, array &$params = [])
{
$value = $expression->getValue();
if ($value instanceof Query) {
list ($sql, $params) = $this->queryBuilder->build($value, $params);
return "($sql)" . $this->getTypecast($expression);
}
if ($value instanceof ArrayExpression) {
$placeholder = 'array_to_json(' . $this->queryBuilder->buildExpression($value, $params) . ')';
} else {
$placeholder = $this->queryBuilder->bindParam(Json::encode($value), $params);
}
return $placeholder . $this->getTypecast($expression);
}
/**
* @param JsonExpression $expression
* @return string the typecast expression based on [[type]].
*/
protected function getTypecast(JsonExpression $expression)
{
if ($expression->getType() === null) {
return '';
}
return '::' . $expression->getType();
}
}