From: paca70 Date: Sun, 27 Apr 2003 16:03:01 +0000 (+0000) Subject: $db->Insert_ID seems to work with postgresql too X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e9ececbb1e1fabf5ec4794c07ceacc5577597fef;p=moodle.git $db->Insert_ID seems to work with postgresql too --- diff --git a/lib/datalib.php b/lib/datalib.php index a7955c8a81..7e8bf3bc76 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -618,10 +618,11 @@ function insert_record($table, $dataobject, $returnid=true) { } if ($returnid) { - if ($CFG->dbtype == "mysql") { + if ($CFG->dbtype == "mysql" || $CFG->dbtype == "postgres7") { return $db->Insert_ID(); // ADOdb has stored the ID for us, but it isn't reliable } + // Try to pull the record out again to find the id. This is the most cross-platform method. if ($rs = $db->Execute("SELECT id FROM $CFG->prefix$table WHERE $select")) { if ($rs->RecordCount() == 1) {