'db=s' => \my $opt_db,
'verbose|v!' => \my $opt_verbose,
'debug|d!' => \my $opt_debug,
+ 'showid!' => \my $opt_showid,
) or exit 1;
my $j = JSON::XS->new->ascii->pretty(0);
id integer primary key,
name text,
title text,
+ type integer,
depth integer,
parent_id integer,
)
});
$node_ins_sth = $dbh->prepare(q{
- INSERT INTO node VALUES (?,?,?,?,?, ?,?,?,?,?,?)
+ INSERT INTO node VALUES (?,?,?,?,?,?, ?,?,?,?,?,?)
});
}
# output
# ...
if ($opt_json) {
- print " " x $x->{depth};
+ print "\t" x $x->{depth};
my $size = $self_size + $x->{kids_size};
print qq(], "data":{ "\$area": $size } },\n);
}
else {
$name .= sprintf " +%s", fmt_size($x->{self_size});
}
+ $name .= " $x->{id}" if $opt_showid;
my @node_attr = (
sprintf("label=%s", $dotnode->($name)),
my $attr_json = $j->encode($x->{attr});
my $leaves_json = $j->encode($x->{leaves});
$node_ins_sth->execute(
- $x->{id}, $x->{name}, $x->{title}, $x->{depth}, $x->{parent_id},
+ $x->{id}, $x->{name}, $x->{title}, $x->{type}, $x->{depth}, $x->{parent_id},
$x->{self_size}, $x->{kids_size}, $x->{kids_node_count},
$x->{child_id} ? join(",", @{$x->{child_id}}) : undef,
$attr_json, $leaves_json,