/home
/forge
/lowcosthotels.com
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connection.php
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try {
$result = $callback($query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (Exception $e) {
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
}
/**
* Log a query in the connection's query log.
*
* @param string $query
* @param array $bindings
* @param float|null $time
* @return void
*/
public function logQuery($query, $bindings, $time = null)
{
$this->event(new QueryExecuted($query, $bindings, $time, $this));
if ($this->loggingQueries) {
Arguments
"""
SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused\n
\tIs the server running on that host and accepting TCP/IP connections? (SQL: select * from "users" where "robot_name" = Claudebot limit 1)
"""
/home
/forge
/lowcosthotels.com
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
* Used by all PDO-based drivers.
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param mixed[]|null $options
*
* @throws PDOException In case of an error.
*/
public function __construct($dsn, $user = null, $password = null, ?array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class, []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function getServerVersion()
{
Arguments
"""
SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused\n
\tIs the server running on that host and accepting TCP/IP connections?
"""
/home
/forge
/lowcosthotels.com
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
use function func_get_args;
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param mixed[]|null $options
*
* @throws PDOException In case of an error.
*/
public function __construct($dsn, $user = null, $password = null, ?array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class, []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
Arguments
"""
SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused\n
\tIs the server running on that host and accepting TCP/IP connections?
"""
/home
/forge
/lowcosthotels.com
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
use function func_get_args;
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param mixed[]|null $options
*
* @throws PDOException In case of an error.
*/
public function __construct($dsn, $user = null, $password = null, ?array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class, []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
Arguments
"pgsql:host=127.0.0.1;dbname=lowcosthotels;port=5432;sslmode=prefer"
"forge"
"0I7kQGufXlZawCXknhE8"
array:4 [
8 => 0
3 => 2
11 => 0
17 => false
]
/home
/forge
/lowcosthotels.com
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/Connector.php
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}
return new PDO($dsn, $username, $password, $options);
}
/**
* Determine if the connection is persistent.
*
* @param array $options
* @return bool
*/
protected function isPersistentConnection($options)
{
return isset($options[PDO::ATTR_PERSISTENT]) &&
$options[PDO::ATTR_PERSISTENT];
}
/**
* Handle an exception that occurred during connect execution.
*
Arguments
"pgsql:host=127.0.0.1;dbname=lowcosthotels;port=5432;sslmode=prefer"
"forge"
"0I7kQGufXlZawCXknhE8"
array:4 [
8 => 0
3 => 2
11 => 0
17 => false
]
/home
/forge
/lowcosthotels.com
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/Connector.php
/**
* Create a new PDO connection.
*
* @param string $dsn
* @param array $config
* @param array $options
* @return \PDO
*
* @throws \Exception
*/
public function createConnection($dsn, array $config, array $options)
{
[$username, $password] = [
$config['username'] ?? null, $config['password'] ?? null,
];
try {
return $this->createPdoConnection(
$dsn, $username, $password, $options
);
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
Arguments
"pgsql:host=127.0.0.1;dbname=lowcosthotels;port=5432;sslmode=prefer"
"forge"
"0I7kQGufXlZawCXknhE8"
array:4 [
8 => 0
3 => 2
11 => 0
17 => false
]
/home
/forge
/lowcosthotels.com
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/PostgresConnector.php
protected $options = [
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
];
/**
* Establish a database connection.
*
* @param array $config
* @return \PDO
*/
public function connect(array $config)
{
// First we'll create the basic DSN and connection instance connecting to the
// using the configuration option specified by the developer. We will also
// set the default character set on the connections to UTF-8 by default.
$connection = $this->createConnection(
$this->getDsn($config), $config, $this->getOptions($config)
);
$this->configureEncoding($connection, $config);
// Next, we will check to see if a timezone has been specified in this config
// and if it has we will issue a statement to modify the timezone with the
// database. Setting this DB timezone is an optional configuration item.
$this->configureTimezone($connection, $config);
$this->configureSchema($connection, $config);
// Postgres allows an application_name to be set by the user and this name is
// used to when monitoring the application with pg_stat_activity. So we'll
// determine if the option has been specified and run a statement if so.
$this->configureApplicationName($connection, $config);
return $connection;
}
/**
Arguments
"pgsql:host=127.0.0.1;dbname=lowcosthotels;port=5432;sslmode=prefer"
array:11 [
"driver" => "pgsql"
"host" => "127.0.0.1"
"port" => "5432"
"database" => "lowcosthotels"
"username" => "forge"
"password" => "0I7kQGufXlZawCXknhE8"
"charset" => "utf8"
"prefix" => ""
"schema" => "public"
"sslmode" => "prefer"
"name" => "app_db"
]
array:4 [
8 => 0
3 => 2
11 => 0
17 => false
]
/home
/forge
/lowcosthotels.com
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/ConnectionFactory.php
{
return array_key_exists('host', $config)
? $this->createPdoResolverWithHosts($config)
: $this->createPdoResolverWithoutHosts($config);
}
/**
* Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
*
* @param array $config
* @return \Closure
*/
protected function createPdoResolverWithHosts(array $config)
{
return function () use ($config) {
foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) {
$config['host'] = $host;
try {
return $this->createConnector($config)->connect($config);
} catch (PDOException $e) {
continue;
}
}
throw $e;
};
}
/**
* Parse the hosts configuration item into an array.
*
* @param array $config
* @return array
*/
protected function parseHosts(array $config)
{
$hosts = Arr::wrap($config['host']);
if (empty($hosts)) {
Arguments
array:11 [
"driver" => "pgsql"
"host" => "127.0.0.1"
"port" => "5432"
"database" => "lowcosthotels"
"username" => "forge"
"password" => "0I7kQGufXlZawCXknhE8"
"charset" => "utf8"
"prefix" => ""
"schema" => "public"
"sslmode" => "prefer"
"name" => "app_db"
]