2011-08-25 22:53:05 -05:00
|
|
|
<?php namespace Laravel\Database\Query;
|
2011-08-19 20:12:39 -05:00
|
|
|
|
2011-08-25 22:53:05 -05:00
|
|
|
use Laravel\Database\Query;
|
|
|
|
|
use Laravel\Database\Connection;
|
2011-08-19 20:12:39 -05:00
|
|
|
|
|
|
|
|
class Factory {
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-22 21:56:42 -05:00
|
|
|
* Create a new query instance based on the connection driver.
|
2011-08-19 20:12:39 -05:00
|
|
|
*
|
2011-08-22 21:56:42 -05:00
|
|
|
* @param string $table
|
2011-08-19 20:12:39 -05:00
|
|
|
* @param Connection $connection
|
2011-08-22 21:56:42 -05:00
|
|
|
* @param Compiler $compiler
|
2011-08-19 20:12:39 -05:00
|
|
|
* @return Query
|
|
|
|
|
*/
|
2011-08-22 21:56:42 -05:00
|
|
|
public static function make($table, Connection $connection, Compiler $compiler)
|
2011-08-19 20:12:39 -05:00
|
|
|
{
|
2011-08-22 21:56:42 -05:00
|
|
|
switch ($connection->driver())
|
2011-08-19 20:12:39 -05:00
|
|
|
{
|
2011-08-19 21:18:59 -05:00
|
|
|
case 'pgsql':
|
2011-08-22 21:56:42 -05:00
|
|
|
return new Postgres($table, $connection, $compiler);
|
2011-08-19 21:18:59 -05:00
|
|
|
|
2011-08-19 20:12:39 -05:00
|
|
|
default:
|
2011-08-22 21:56:42 -05:00
|
|
|
return new Query($table, $connection, $compiler);
|
2011-08-19 20:12:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|