6 use NonameTV
::DataStore
;
7 use NonameTV
::Config qw
/ReadConfig/;
12 my $conf = ReadConfig
();
15 my $ds = NonameTV
::DataStore
->new( $conf->{DataStore
} );
17 # print "Deleting old programs and batches from database\n";
18 $ds->sa->DoSql( "delete from programs where TO_DAYS(now()) - TO_DAYS(start_time) > 1" );
20 # print "Deleting batches\n";
22 # Retrieve a list of all batches with no matching programme.
23 my( $res, $sth ) = $ds->sa->Sql( "select batches.id, batches.name from batches left join programs on batches.id=programs.batch_id where programs.batch_id is null;" );
25 while( my $d = $sth->fetchrow_hashref() )
27 # print $d->{name} . "\n";
28 $ds->sa->Delete( 'batches', { id
=> $d->{id
} } );