@param $value

@return string

@throws DBALException
174020
public function createSingleValueNamedParameter($value): string
    {
        $paramName = $this->createNamedParameter($this->getPdoValue($value), $this->getPdoType($value));

        return $paramName;
    }
232747
public static function getStringValue($value): string
    {
        if ($value instanceof \DateTime) {
            return $value->format(self::DEFAULT_DATETIME_FORMAT);
        } elseif (is_bool($value)) {
            return $value ? 'true' : 'false';
        } elseif (is_array($value)) {
            return implode(', ', array_map('self::getStringValue', $value));
        }

        return (string) $value;
    }
962468
protected function databaseValue($value)
    {
        if (!$value instanceof \DateTime) {
            throw ODMException::conversionFailedInvalidType($value, Type::TIMESTAMP, ['null', 'DateTime']);
        }

        return (string)$value->getTimestamp();
    }
393013
public function escape($value)
	{

		//put this in try...catch block for better error handling
		try{

			//check if there is a valid service instance
			if (! $this->validService() ) 
			{
				//throw exceptions
				throw new MySQLException("Not connected to a valid database service");

			}

			//escape and return output
			return $this->service->real_escape_string($value);

		}

		//diplay error message
		catch(MySQLException $MySQLExceptionObject){

			//display error message
			$MySQLExceptionObject->errorShow();

		}
		
	}
452809
protected function getQuoteValue($value): string
    {
        $key = uniqid();
        $this->builder->setParameter($key, $value);

        return ":{$key}";
    }
373443
public function serialize($value): string
    {
        if ($value instanceof Carbon) {
            return $value->toDateTimeString();
        }

        return $this
            ->tryParsingDateTime($value, InvariantViolation::class)
            ->toDateTimeString();
    }
943738
public function displayValue( $value )
    {
        if ( $this->getUseRegularExpression() )
        {
            return preg_replace( $this->getFrom(), $this->getTo(), $value );
        }
        else
        {
            return str_replace( $this->getFrom(), $this->getTo(), $value );
        }
    }
720625
public function escapeLikeValue(string $value): string
    {
        // Backslash is used to escape wildcards.
        $value = str_replace('\\', '\\\\', $value);
        // Standard wildcards are underscore and percent sign.
        $value = str_replace('%', '\\%', $value);
        $value = str_replace('_', '\\_', $value);

        if ($this->dbEngine === 'mssql') {
            // MSSQL also includes character ranges.
            $value = str_replace('[', '\\[', $value);
            $value = str_replace(']', '\\]', $value);
        }

        return $value;
    }
1302011
public static function convertToDb($value)
    {
        $dbValue = null;

        if (is_array($value)) {
            $dbValue = (object) $value;
        } elseif ($value instanceof \ArrayObject) {
            $dbValue = (object) $value->getArrayCopy();
        } elseif (is_object($value)) {
            $dbValue = (object) get_object_vars($value);
        }

        if (!is_null($dbValue)) {
            $dbValue = (object) self::processDynamicParts($dbValue);
        }

        return $dbValue;
    }
128307
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return null;
        }

        if (static::$basePath !== '' && \strpos($value->getPathname(), static::$basePath) !== 0) {
            throw new \LogicException(\sprintf('Invalid path or "basePath" ("%s") configuration', static::$basePath));
        }

        return \substr($value->getPathname(), \strlen(static::$basePath));
    }
572865
public function geetParamTypeByValue($value)
	{
		switch(gettype($value))
		{
			case 'boolean':
				return PDO::PARAM_BOOL;
				break;
			case 'integer':
				return PDO::PARAM_INT;
				break;
			case 'NULL':
				return PDO::PARAM_NULL;
				break;
			default:
				return PDO::PARAM_STR;
				break;
		}
	}
1360286
protected function _quote($value)
    {
        if (is_int($value) || is_float($value)) {
            return $value;
        }
        /**
         * Use db2_escape_string() if it is present in the IBM DB2 extension.
         * But some supported versions of PHP do not include this function,
         * so fall back to default quoting in the parent class.
         */
        if (function_exists('db2_escape_string')) {
            return "'" . db2_escape_string($value) . "'";
        }
        return parent::_quote($value);
    }
180954
private function decorateValue($value) : string
    {
        $ret = 'null';
        switch(gettype($value)){
            case 'string':
                $ret = $this->decorateStringValue($value);
                break;
            case 'integer':
            case 'double':
                $ret = $value;
                break;
            case 'boolean':
                $ret = $value ? 'true' : 'false';
                break;
            case 'array':
                $ret = $this->decorateArrayValue($value);
                break;
        }
        return $ret;
    }
583689
public function convert($value)
    {
        switch (gettype($value)) {
            case 'string':
                $result = '\'' . pg_escape_string($value) . '\'';
                break;
            case 'array':
                $data = array_map(function ($item) {
                    return $this->convert($item);
                }, $value);

                $result = '[' . implode(',', $data) . ']';
                break;
            case 'double':
            case 'integer':
                $result = $value < -2147483648 || 2147483647 < $value ? $value . '::bigint' : $value;
                break;
            case 'NULL':
                $result = 'null';
                break;
            case 'boolean':
                $result = $value ? 'true' : 'false';
                break;
            default:
                throw new DbException('Unsupported type ' . gettype($value), DbException::WRONG_TYPE);
        }

        return $result;
    }
1373038
public function dbTypecastValue($value)
    {
        if ($value === null) {
            return null;
        }

        switch ($this->type) {
            case Schema::TYPE_BIT:
                return decbin($value);
            case Schema::TYPE_BINARY:
                return is_string($value) ? new PdoValue($value, \PDO::PARAM_LOB) : $value;
            case Schema::TYPE_TIMESTAMP:
            case Schema::TYPE_DATETIME:
                return \Yii::$app->formatter->asDatetime($value, 'yyyy-MM-dd HH:mm:ss');
            case Schema::TYPE_DATE:
                return \Yii::$app->formatter->asDate($value, 'yyyy-MM-dd');
            case Schema::TYPE_TIME:
                return \Yii::$app->formatter->asTime($value, 'HH:mm:ss');
            case Schema::TYPE_JSON:
                return new JsonExpression($value, $this->dbType);
            case Schema::TYPE_COMPOSITE:
                return new CompositeExpression($value, $this->dbType, $this);
        }

        return $this->typecast($value);
    }
507833
public function toBigQuery($value)
    {
        if ($value instanceof ValueInterface || $value instanceof Int64) {
            return (string) $value;
        }

        if ($value instanceof \DateTime) {
            return $value->format(self::DATETIME_FORMAT_INSERT);
        }

        if (is_array($value)) {
            foreach ($value as $key => $item) {
                $value[$key] = $this->toBigQuery($item);
            }

            return $value;
        }

        return $value;
    }
881943
public function getDatabaseValue($value)
        {
            if (is_bool($value)) {
                if (Core::getDriver() == Core::DRIVER_MYSQL) {
                    return (int) $value;
                } elseif (Core::getDriver() == Core::DRIVER_POSTGRES) {
                    return ($value) ? 'true' : 'false';
                }
            }
            return $value;
        }