Commit 2521ab3c authored by Taylor Otwell's avatar Taylor Otwell

refactoring the database layer.

parent 3ada2cbd
<?php namespace Laravel\Database\Connector;
use Laravel\Database\Connector;
class Callback extends Connector {
/**
......
<?php namespace Laravel\Database;
<?php namespace Laravel\Database\Connector;
use PDO;
......
<?php namespace Laravel\Database\Connector;
use Laravel\Database\Connector;
use PDO;
class MySQL extends Connector {
......@@ -24,7 +24,7 @@ class MySQL extends Connector {
$dsn .= ';unix_socket='.$config['socket'];
}
$connection = new \PDO($dsn, $config['username'], $config['password'], $this->options);
$connection = new PDO($dsn, $config['username'], $config['password'], $this->options);
if (isset($config['charset']))
{
......
<?php namespace Laravel\Database\Connector;
use Laravel\Database\Connector;
use PDO;
class Postgres extends Connector {
......@@ -19,7 +19,7 @@ class Postgres extends Connector {
$dsn .= ';port='.$config['port'];
}
$connection = new \PDO($dsn, $config['username'], $config['password'], $this->options);
$connection = new PDO($dsn, $config['username'], $config['password'], $this->options);
if (isset($config['charset']))
{
......
<?php namespace Laravel\Database\Connector;
use Laravel\Database\Connector;
use PDO;
class SQLite extends Connector {
......@@ -14,15 +14,15 @@ class SQLite extends Connector {
{
if ($config['database'] == ':memory:')
{
return new \PDO('sqlite::memory:', null, null, $this->options);
return new PDO('sqlite::memory:', null, null, $this->options);
}
elseif (file_exists($path = DATABASE_PATH.$config['database'].'.sqlite'))
{
return new \PDO('sqlite:'.$path, null, null, $this->options);
return new PDO('sqlite:'.$path, null, null, $this->options);
}
elseif (file_exists($config['database']))
{
return new \PDO('sqlite:'.$config['database'], null, null, $this->options);
return new PDO('sqlite:'.$config['database'], null, null, $this->options);
}
throw new \Exception("SQLite database [".$config['database']."] could not be found.");
......
<?php namespace Laravel\Database\Query;
<?php namespace Laravel\Database\Query\Compiler;
use Laravel\Database\Query;
......
<?php namespace Laravel\Database\Query\Compiler;
use Laravel\Database\Connection;
use Laravel\Database\Query\Compiler;
class Factory {
......
<?php namespace Laravel\Database\Query\Compiler;
use Laravel\Database\Query\Compiler;
class MySQL extends Compiler {
/**
......
<?php namespace Laravel\Database\Query\Compiler;
use Laravel\Database\Query\Compiler;
class Postgres extends Compiler {
/**
......
<?php namespace Laravel\Database\Query;
use Laravel\Database\Query;
use Laravel\Database\Connection;
class Factory {
......
<?php namespace Laravel\Database\Query;
use Laravel\Database\Query;
use PDO;
class Postgres extends Query {
......@@ -16,7 +16,7 @@ class Postgres extends Query {
$query->execute(array_values($values));
return (int) $query->fetch(\PDO::FETCH_CLASS, 'stdClass')->id;
return (int) $query->fetch(PDO::FETCH_CLASS, 'stdClass')->id;
}
}
\ No newline at end of file
<?php namespace Laravel\Database;
<?php namespace Laravel\Database\Query;
use Laravel\Database\Connection;
class Query {
......@@ -90,12 +92,12 @@ class Query {
/**
* Create a new query instance.
*
* @param Connection $connection
* @param Compiler $compiler
* @param string $table
* @param Database\Connection $connection
* @param Compiler $compiler
* @param string $table
* @return void
*/
public function __construct(Connection $connection, Query\Compiler $compiler, $table)
public function __construct(Connection $connection, Compiler\Compiler $compiler, $table)
{
$this->table = $table;
$this->compiler = $compiler;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment