#!/usr/bin/perl
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2001 by Open Source Development Network. See README
# and COPYING for more information, or see http://slashcode.com/.
# $Id: sqlps,v 1.3 2001/03/21 13:45:49 brian Exp $

###############################################################################
# this gives a process list of the database
###############################################################################
@p=split /\|\n/, `mysqladmin -u root processlist`;
foreach(@p) {
	if(!/^\+/ and !/Sleep/ and !/localhost/) {
		s/\s/ /g;
		s/  / /g;
		s/[^_\'\-\+\.A-Z0-9\(\) ,=\|]//gi;
		s/SELECT(.*)FROM/SELECT:FROM/g;
		my @x=split(/\|/);
		
		$x[3]=~s/\.dn\.net//g;
		
		my $s="$x[3]$x[6]\t$x[8]";
		
		$s=substr ($s,1,75);
		print "$s\n";
	}
}

print "\n";
