Files
spa-api/laravel/database/query/postgres.php

22 lines
481 B
PHP
Raw Normal View History

<?php namespace Laravel\Database\Query;
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-08-22 21:56:42 -05:00
$query = $this->connection->pdo->prepare($this->compiler->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
}
}