[flag table=mv_metadata type=write]
[perl tables="mv_metadata quickpoll quickpoll_answer" global=1]
	use vars qw/ %Db /;
	my $db = $Db{mv_metadata};
	my $sdb = $Db{quickpoll};
	my @del = qw/
		quickpoll::choices
		quickpoll::code
		quickpoll::colors
		quickpoll::num_answers
		quickpoll::question
		quickpoll
		quickpoll::title
	/;

	my @out;
	my $deleted = 0;

	for(@del) {
		$db->delete_record($_)
			and $deleted++;
	}
	push @out, errmsg("%s records deleted from %s", $deleted, 'mv_metadata');

	my $t_deleted;

	my @tables = qw/ quickpoll quickpoll_answer /;
	my $t_count = @tables;
	my $u_count = 0;

	my @unlink;

	for(@tables) {
		my $db = $Db{$_};
		push @unlink, $db->config('db_file_extended');

		$u_count++;
		my $other = Vend::File::catfile($db->config('DIR'), $db->config('file'));
		push @unlink, $other;
		$u_count++;

		my $return = $sdb->query( { sql => "drop table $_", list => 1, body => '[sql-code]'});
		$t_deleted++ if $return > 1;
	}

	push @out, "$t_deleted tables (of $t_count) deleted.";

	my $u_actual = unlink @unlink;
	push @out, "$u_actual files (of $u_count) deleted.";

	return join "<br>", @out;

[/perl]
