Merged from MOODLE_14_STABLE: Fixing problem with set up of site course

This commit is contained in:
mjollnir_
2005-04-06 22:25:31 +00:00
parent e05d5931a2
commit 2eab06687a
+2 -2
View File
@@ -1072,7 +1072,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
/// The efficient and transaction-safe strategy is to
/// move the sequence forward first, and make the insert
/// with an explicit id.
if ( !isset($dataobject->{$primarykey})
if ( empty($dataobject->{$primarykey})
&& $CFG->dbtype === 'postgres7'
&& $returnid == true ) {
if ($nextval = (int)get_field_sql("SELECT NEXTVAL('{$CFG->prefix}{$table}_{$primarykey}_seq')")) {
@@ -1100,7 +1100,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
/// We already know the record PK if it's been passed explicitly,
/// or if we've retrieved it from a sequence (Postgres).
if (isset($dataobject->{$primarykey})) {
if (!empty($dataobject->{$primarykey})) {
return $dataobject->{$primarykey};
}