if($parent) { build_thread_cache($parent); }
else # must find out what our new thread number is
{
if($filename)
{
$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE image=?;") or make_error(S_SQLFAIL);
$sth->execute($filename) or make_error(S_SQLFAIL);
}
else
{
$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE timestamp=? AND comment=?;") or make_error(S_SQLFAIL);
$sth->execute($time,$comment) or make_error(S_SQLFAIL);
}
my $num=($sth->fetchrow_array())[0];
if($num)
{
build_thread_cache($num);
}
}
is what I used as a base for it. I'm not very good at Perl, so I'm just happy it works.