#!/bin/bash
#
# Prints the contents of a given backup volume as file_area 
# and total megabytes from that area.
#
# This is currently slow because the "p_files"-table doesn't 
# have an index for "file_backup" -field.
#

############################

if [ ! $1 ] ; then
	echo "Usage: p_con [backup_id]"
	exit
fi

mysql --execute="USE pimppa;SELECT area_id, area_name, sum(file_size)/(1024*1024) as 'Megs' FROM p_files, p_areas WHERE file_backup=\"$1\" AND file_area=area_id GROUP BY area_name ORDER BY 'Megs' DESC;"
