2011-09-12 23:14:24 -05:00
|
|
|
<?php namespace Laravel\Database\Queries;
|
2011-08-19 20:12:39 -05:00
|
|
|
|
2011-09-11 23:25:31 -05:00
|
|
|
use PDO;
|
2011-08-19 20:12:39 -05:00
|
|
|
|
|
|
|
|
class Postgres extends Query {
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-22 21:56:42 -05:00
|
|
|
* Insert an array of values into the database table and return the value of the ID column.
|
|
|
|
|
*
|
2011-08-19 20:12:39 -05:00
|
|
|
* @param array $values
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function insert_get_id($values)
|
|
|
|
|
{
|
2011-09-12 23:14:24 -05:00
|
|
|
$query = $this->connection->pdo->prepare($this->grammar->insert_get_id($this, $values));
|
2011-08-19 20:12:39 -05:00
|
|
|
|
|
|
|
|
$query->execute(array_values($values));
|
|
|
|
|
|
2011-09-11 23:25:31 -05:00
|
|
|
return (int) $query->fetch(PDO::FETCH_CLASS, 'stdClass')->id;
|
2011-08-19 20:12:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|