#!/usr/bin/perl use File::Copy; require "prontolib.pl"; &read_prefs(); $conn=&open_db_conn; &fix_boxlist; sub fix_boxlist { my($parent) = @_; my($sql,$query,$query2,@row,$lastid); if(defined $parent) { $sql = "select id,sibling,parent from boxlist where parent=? order by id desc"; $query=$main::conn->prepare($sql); $query->execute($parent); } else { $sql = "select id,sibling,parent from boxlist where (parent=-1 or parent is NULL) order by id desc"; $query=$main::conn->prepare($sql); $query->execute(); } $lastid=65535; while(@row=$query->fetchrow_array()) { $sql = "update boxlist set sibling=? where id=?"; $query2=$main::conn->prepare($sql); $query2->execute($lastid,$row[0]); $lastid=$row[0]; &fix_boxlist($row[0]); } }