my $dbh = $self->connect_db;
my $rs = $dbh->do($sql, undef, $tagname_id, $globj_id, $uid, $private, $active);
if (!$rs) {
- $self->set_errorno($dbh->err);
+ $self->last_error($dbh->err);
$self->disconnect_db;
return;
}
my $id = $dbh->last_insert_id(undef, undef, undef, undef);
$self->disconnect_db;
+
+ if (!$id) {
+ $rs = $self->select(tagnameid => $tagname_id,
+ globjid => $globj_id);
+ if (!$rs) {
+ $self->last_error($dbh->err);
+ $self->disconnect_db;
+ return;
+ }
+ $id = $rs->[0]->{tagid};
+ }
return $id;
}