#!/usr/bin/perl # ================================================================== # Links SQL - Wiki_Scraping plugin # # Website : http://cgito.net # Support : dat@cgito.net # CVS Info : 087,071,085,088,086 # # Copyright (c) 2005 CGITO.net. All Rights Reserved. # Redistribution in part or in whole strictly prohibited. Please # see LICENSE file for full details. # ================================================================== use strict; use lib './'; use Links qw/$IN $DB/; local $SIG{__DIE__} = \&Links::fatal; Links::init('./'); &main(); sub main{ my(%catlinks); my $db = $DB->table('CatLinks'); my $sth = $db->select(); print $IN->header; print "Removing duplicated records of Catlinks"; my $count =0; if(defined $sth and $sth->rows){ while(my $row = $sth->fetchrow_hashref){ my $k = $row->{CategoryID} . ':' . $row->{LinkID}; $catlinks{"$k"}++; $count++; } } print "
There are $count records..."; print "
Override them now..."; $count=0; ### remove all records now $db->delete_all; foreach(keys %catlinks){ my($catid,$lid)=split(/\:/,$_); $db->insert({CategoryID=> $catid,LinkID=> $lid}); $count++; } print "Done."; print "
There are $count records in Table CatLinks now"; }