From c651e15160f41980768a6ad7490d62fb0e0dd636 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 29 Jan 2006 06:55:28 +0000 Subject: [PATCH] DB_PostgreSQL::insert_id() is now done right :) --- db_postgresql.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/db_postgresql.php b/db_postgresql.php index f87749a..a01b5f2 100644 --- a/db_postgresql.php +++ b/db_postgresql.php @@ -222,17 +222,15 @@ class DB_PostgreSQL extends DB_Abstract * * @access public * - * @param integer Result - * @param string PostgreSQL sequence + * @param string Table name + * @param string Auto-up field * * @return integer Insert ID */ - function insert_id($result, $sequence) + function insert_id($table, $field) { - $temp = $this->query("SELECT currval($sequence) AS auto_inc"); - //$temp = call_user_func($this->commands['query'], "SELECT currval($table_col)"); - var_dump( $temp); - print_r($this->fetch_array($temp)); + $temp = $this->query_first("SELECT last_value FROM {$table}_{$field}_seq"); + return $temp['last_value']; } } -- 2.43.5