]> git.mjollnir.org Git - moodle.git/commitdiff
$db->Insert_ID seems to work with postgresql too
authorpaca70 <paca70>
Sun, 27 Apr 2003 16:03:01 +0000 (16:03 +0000)
committerpaca70 <paca70>
Sun, 27 Apr 2003 16:03:01 +0000 (16:03 +0000)
lib/datalib.php

index a7955c8a81acbaeb38e2abeb053d2a60143af85d..7e8bf3bc76ef3a3888f8440a32d286f20bb218c0 100644 (file)
@@ -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) {