1: <?php
2:
3: namespace PHPixie\Database\Driver\PDO\Adapter;
4:
5: class Pgsql extends \PHPixie\Database\Driver\PDO\Adapter
6: {
7: public function __construct($config, $connection)
8: {
9: parent::__construct($config, $connection);
10: $this->connection->execute("SET NAMES 'utf8'");
11: }
12:
13: public function insertId()
14: {
15: try {
16: return $this->connection->execute('SELECT lastval() as id')->get('id');
17: } catch (\Exception $e) {
18: throw new \PHPixie\Database\Exception('Cannot get last insert id, probably no rows have been inserted yet.');
19: }
20: }
21:
22: public function listColumns($table)
23: {
24: return $this->connection
25: ->execute("select column_name from information_schema.columns where table_name = '{$table}' and table_catalog = current_database()")
26: ->getField('column_name');
27: }
28: }
29: