more 2.0 changes

This commit is contained in:
Taylor Otwell
2011-08-19 20:12:39 -05:00
parent 73b1cb78f4
commit 5b85edb23b
38 changed files with 951 additions and 614 deletions

View File

@@ -0,0 +1,24 @@
<?php namespace Laravel\DB\Query;
use Laravel\DB\Query;
class Postgres extends Query {
/**
* Execute an INSERT statement and get the insert ID.
*
* @param array $values
* @return int
*/
public function insert_get_id($values)
{
$sql = $this->compile_insert($values);
$query = $this->connection->pdo->prepare($sql.' RETURNING '.$this->wrap('id'));
$query->execute(array_values($values));
return $query->fetch(\PDO::FETCH_CLASS, 'stdClass')->id;
}
}