Commit b2fa89ac authored by Jonathon Duerig's avatar Jonathon Duerig

More ptogen_new optimization.

It is now only 1/3 slower than the original. The price of modularity. *sigh*
parent 04695250
......@@ -1428,6 +1428,14 @@ sub NodeTypeInfo($)
return $nodetype;
}
sub SetNodeTypeInfo($$)
{
my ($self, $nodetype) = @_;
if ($self->type() eq $nodetype->type()) {
$self->{"TYPEINFO"} = $nodetype;
}
}
#
# Lookup a specific attribute in the nodetype info.
#
......
......@@ -55,10 +55,17 @@ sub Lookup($$)
return undef
if (!$query_result || !$query_result->numrows);
return LookupRow($class, $type, $query_result->fetchrow_hashref());
}
sub LookupRow($$$)
{
my ($class, $type, $row) = @_;
my $self = {};
# Do not use the embedded type field, cause of auxtypes.
$self->{"TYPE"} = $type;
$self->{"DBROW"} = $query_result->fetchrow_hashref();
$self->{"DBROW"} = $row;
$self->{"ATTRS"} = undef;
bless($self, $class);
......@@ -67,6 +74,7 @@ sub Lookup($$)
$nodetypes{$type} = $self;
return $self;
}
# accessors
sub field($$) { return ((! ref($_[0])) ? -1 : $_[0]->{'DBROW'}->{$_[1]}); }
# Do not use the embedded type field, cause of auxtypes.
......
This diff is collapsed.
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