Commit a35f8bdc authored by Leigh Stoller's avatar Leigh Stoller

Add a SetAttribute() method.

parent fa361e4b
...@@ -319,6 +319,33 @@ sub isdedicatedremote($;$) { ...@@ -319,6 +319,33 @@ sub isdedicatedremote($;$) {
} }
sub control_interface($;$) { return control_iface($_[0], $_[1]); } sub control_interface($;$) { return control_iface($_[0], $_[1]); }
#
# Set the value of an attribute
#
sub SetAttribute($$$;$)
{
my ($self, $attrkey, $attrvalue, $attrtype) = @_;
goto bad
if (!ref($self));
$self->LoadAttributes() == 0
or return -1;
$attrtype = "string"
if (!defined($attrtype));
my $safe_attrvalue = DBQuoteSpecial($attrvalue);
my $type = $self->type();
DBQueryWarn("replace into node_type_attributes set ".
" type='$type', attrkey='$attrkey', ".
" attrtype='$attrtype', attrvalue=$safe_attrvalue")
or return -1;
$self->{"ATTRS"}->{$attrkey} = $attrvalue;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
1; 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment