Permalink
Browse files

$db->Insert_ID seems to work with postgresql too

  • Loading branch information...
1 parent 5352ceb commit e9ececbb1e1fabf5ec4794c07ceacc5577597fef paca70 committed Apr 27, 2003
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/datalib.php
View
@@ -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) {

0 comments on commit e9ececb

Please sign in to comment.