Fixing problem with set up of site course
This commit is contained in:
+2
-2
@@ -912,7 +912,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')")) {
|
||||
@@ -942,7 +942,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
|
||||
/// 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};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user