From ace2a553bb9824fd4b961a1286507d5cb18d48b8 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 29 Jan 2006 07:00:24 +0000 Subject: [PATCH] Add support for PGSQL in API::insert() --- api.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/api.php b/api.php index a465f75..d3ab9f4 100644 --- a/api.php +++ b/api.php @@ -395,7 +395,24 @@ class API } $this->registry->modules[ISSO_DB_LAYER]->query("INSERT INTO {$this->prefix}{$this->table} (" . implode(',', $fields) . ") VALUES (" . implode(',', $values) . ")"); - $this->insertid = $this->registry->modules[ISSO_DB_LAYER]->insert_id(); + + if (ISSO_DB_LAYER == 'DB_PostgreSQL') + { + foreach ($this->fields AS $field => $info) + { + if ($info[F_REQ] == REQ_AUTO) + { + $autofield = $field; + break; + } + } + + $this->insertid = $this->registry->modules[ISSO_DB_LAYER]->insert_id($this->table, $autofield); + } + else + { + $this->insertid = $this->registry->modules[ISSO_DB_LAYER]->insert_id(); + } $this->run_action_method('post_insert'); } -- 2.22.5