diff --git a/laravel/database/connection.php b/laravel/database/connection.php
index 3f501635..bef05f26 100644
--- a/laravel/database/connection.php
+++ b/laravel/database/connection.php
@@ -140,14 +140,7 @@ class Connection {
*/
public function table($table)
{
- switch ($this->driver())
- {
- case 'pgsql':
- return new Queries\Postgres($this, $this->grammar(), $table);
-
- default:
- return new Queries\Query($this, $this->grammar(), $table);
- }
+ return new Query($this, $this->grammer(), $table);
}
/**
diff --git a/laravel/database/queries/query.php b/laravel/database/query.php
similarity index 79%
rename from laravel/database/queries/query.php
rename to laravel/database/query.php
index 73e25969..743de412 100644
--- a/laravel/database/queries/query.php
+++ b/laravel/database/query.php
@@ -1,13 +1,11 @@
-
- * $query->select(array('id', 'email'));
- *
- *
* @param array $columns
* @return Query
*/
@@ -136,10 +130,6 @@ class Query {
/**
* Add a join clause to the query.
*
- *
- * $query->join('users', 'users.id', '=', 'posts.user_id');
- *
- *
* @param string $table
* @param string $column1
* @param string $operator
@@ -157,10 +147,6 @@ class Query {
/**
* Add a left join to the query.
*
- *
- * $query->left_join('users', 'users.id', '=', 'posts.user_id');
- *
- *
* @param string $table
* @param string $column1
* @param string $operator
@@ -187,10 +173,6 @@ class Query {
/**
* Add a raw where condition to the query.
*
- *
- * $query->raw_where('user_id = ? and password = ?', array(1, 'secret'));
- *
- *
* @param string $where
* @param array $bindings
* @param string $connector
@@ -208,10 +190,6 @@ class Query {
/**
* Add a raw or where condition to the query.
*
- *
- * $query->raw_or_where('user_id = ? and password = ?', array(1, 'secret'));
- *
- *
* @param string $where
* @param array $bindings
* @return Query
@@ -224,10 +202,6 @@ class Query {
/**
* Add a where condition to the query.
*
- *
- * $query->where('id', '=', 1);
- *
- *
* @param string $column
* @param string $operator
* @param mixed $value
@@ -246,10 +220,6 @@ class Query {
/**
* Add an or where condition to the query.
*
- *
- * $query->or_where('id', '=', 1);
- *
- *
* @param string $column
* @param string $operator
* @param mixed $value
@@ -260,28 +230,9 @@ class Query {
return $this->where($column, $operator, $value, 'OR');
}
- /**
- * Add a where condition for the primary key to the query.
- *
- *
- * $query->where_id(1);
- *
- *
- * @param mixed $value
- * @return Query
- */
- public function where_id($value)
- {
- return $this->where('id', '=', $value);
- }
-
/**
* Add an or where condition for the primary key to the query.
*
- *
- * $query->or_where_id(1);
- *
- *
* @param mixed $value
* @return Query
*/
@@ -293,10 +244,6 @@ class Query {
/**
* Add a where in condition to the query.
*
- *
- * $query->where_in('id', array(1, 2, 3));
- *
- *
* @param string $column
* @param array $values
* @param string $connector
@@ -315,10 +262,6 @@ class Query {
/**
* Add an or where in condition to the query.
*
- *
- * $query->or_where_in('id', array(1, 2, 3));
- *
- *
* @param string $column
* @param array $values
* @return Query
@@ -331,10 +274,6 @@ class Query {
/**
* Add a where not in condition to the query.
*
- *
- * $query->where_not_in('id', array(1, 2, 3));
- *
- *
* @param string $column
* @param array $values
* @param string $connector
@@ -348,10 +287,6 @@ class Query {
/**
* Add an or where not in condition to the query.
*
- *
- * $query->or_where_not_in('id', array(1, 2, 3));
- *
- *
* @param string $column
* @param array $values
* @return Query
@@ -457,14 +392,6 @@ class Query {
/**
* Add an ordering to the query.
*
- *
- * // Set an ascending sort on the query
- * $query->order_by('votes', 'asc');
- *
- * // Set a descending sort on the query
- * $query->order_by('votes', 'desc');
- *
- *
* @param string $column
* @param string $direction
* @return Query
@@ -507,11 +434,6 @@ class Query {
*
* If the given page is not an integer or is less than zero, one will be used.
*
- *
- * // Get the the 15 users that should be displayed for page 1
- * $results = DB::table('users')->for_page(1, 15);
- *
- *
* @param int $page
* @param int $per_page
* @return Query
@@ -526,11 +448,6 @@ class Query {
/**
* Find a record by the primary key.
*
- *
- * // Get the user having an ID of 1
- * $user = DB::table('users')->find(1);
- *
- *
* @param int $id
* @param array $columns
* @return object
@@ -593,11 +510,6 @@ class Query {
/**
* Insert an array of values into the database table.
*
- *
- * // Insert into the "users" table
- * $success = DB::table('users')->insert(array('id' => 1, 'email' => 'example@gmail.com'));
- *
- *
* @param array $values
* @return bool
*/
@@ -609,29 +521,20 @@ class Query {
/**
* Insert an array of values into the database table and return the value of the ID column.
*
- *
- * // Insert into the "users" table and get the auto-incrementing ID
- * $id = DB::table('users')->insert_get_id(array('email' => 'example@gmail.com'));
- *
- *
- * @param array $values
+ * @param array $values
+ * @param string $sequence
* @return int
*/
- public function insert_get_id($values)
+ public function insert_get_id($values, $sequence = null)
{
$this->connection->query($this->grammar->insert($this, $values), array_values($values));
- return (int) $this->connection->pdo->lastInsertId();
+ return (int) $this->connection->pdo->lastInsertId($sequence);
}
/**
* Update an array of values in the database table.
*
- *
- * // Update a user's e-mail address
- * $affected = DB::table('users')->where_id(1)->update(array('email' => 'new_email@example.com'));
- *
- *
* @param array $values
* @return int
*/
@@ -645,17 +548,6 @@ class Query {
*
* Optionally, an ID may be passed to the method do delete a specific row.
*
- *
- * // Delete everything from the "users" table
- * $affected = DB::table('users')->delete();
- *
- * // Delete a specific user from the table
- * $affected = DB::table('users')->delete(1);
- *
- * // Execute a delete statement with where conditions
- * $affected = DB::table('users')->where_email($email)->delete();
- *
- *
* @param int $id
* @return int
*/
@@ -669,15 +561,8 @@ class Query {
/**
* Magic Method for handling dynamic functions.
*
- * This method handles all calls to aggregate functions as well as the construction of dynamic where clauses.
- *
- *
- * // Get the total number of rows on the "users" table
- * $count = DB::table('users')->count();
- *
- * // Get a user using a dynamic where clause
- * $user = DB::table('users')->where_email('example@gmail.com')->first();
- *
+ * This method handles all calls to aggregate functions as well as the construction
+ * of dynamic where clauses via the "dynamic_where" method.
*/
public function __call($method, $parameters)
{