Skip to content

Commit

Permalink
Merge pull request #30998 from themsaid/pr/16983
Browse files Browse the repository at this point in the history
[6.x] Prevent making actual pdo connections while reconnecting
  • Loading branch information
taylorotwell authored Jan 2, 2020
2 parents 0b748bc + 6714637 commit a47cd1b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,16 @@ public function getPdo()
return $this->pdo;
}

/**
* Get the raw current PDO connection parameter.
*
* @return \PDO|\Closure|null
*/
public function getRawPdo()
{
return $this->pdo;
}

/**
* Get the current PDO connection used for reading.
*
Expand All @@ -949,6 +959,16 @@ public function getReadPdo()
return $this->readPdo ?: $this->getPdo();
}

/**
* Get the raw current read PDO connection parameter.
*
* @return \PDO|\Closure|null
*/
public function getRawReadPdo()
{
return $this->readPdo;
}

/**
* Set the PDO connection.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/DatabaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ protected function refreshPdoConnections($name)
$fresh = $this->makeConnection($name);

return $this->connections[$name]
->setPdo($fresh->getPdo())
->setReadPdo($fresh->getReadPdo());
->setPdo($fresh->getRawPdo())
->setReadPdo($fresh->getRawReadPdo());
}

/**
Expand Down

0 comments on commit a47cd1b

Please sign in to comment.