Allow the registration of custom database drivers.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?php namespace Laravel\Database; use PDO, PDOStatement, Laravel\Config, Laravel\Event;
|
||||
<?php namespace Laravel\Database;
|
||||
|
||||
use PDO, PDOStatement, Laravel\Config, Laravel\Event;
|
||||
|
||||
class Connection {
|
||||
|
||||
@@ -71,7 +73,12 @@ class Connection {
|
||||
{
|
||||
if (isset($this->grammar)) return $this->grammar;
|
||||
|
||||
switch (isset($this->config['grammar']) ? $this->config['grammar'] : $this->driver())
|
||||
if (isset(\Laravel\Database::$registrar[$this->driver()]))
|
||||
{
|
||||
\Laravel\Database::$registrar[$this->driver()]['query']();
|
||||
}
|
||||
|
||||
switch ($this->driver())
|
||||
{
|
||||
case 'mysql':
|
||||
return $this->grammar = new Query\Grammars\MySQL($this);
|
||||
@@ -300,7 +307,7 @@ class Connection {
|
||||
*/
|
||||
public function driver()
|
||||
{
|
||||
return $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
return $this->config['driver'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,6 +148,11 @@ class Schema {
|
||||
{
|
||||
$driver = $connection->driver();
|
||||
|
||||
if (isset(\Laravel\Database::$registrar[$driver]))
|
||||
{
|
||||
return \Laravel\Database::$registrar[$driver]['schema']();
|
||||
}
|
||||
|
||||
switch ($driver)
|
||||
{
|
||||
case 'mysql':
|
||||
|
||||
Reference in New Issue
Block a user