<%args>
$reqkey=>undef
$records=>undef
$extra=>undef
</%args>
<%init>
my $dbh = $m->comp("/_shared/procs/utils/dbi_connect.m", database=>'guianet');
my ($id,$currecs) = $dbh->selectrow_array("select id, records from tdownloads where reqkey='$reqkey'");
if ($id){
	$dbh->do("update tdownloads set records='$records',extra='$extra' where id='$id'") if ($currecs != $records);
}else{	
	$dbh->do("insert into tdownloads(reqkey,records,created,downloads,extra) values('$reqkey',$records,NOW(),0,'$extra')");
}
return $id;
</%init>
