<%doc>
# 
# $Id: sql-query.ipfc,v 1.4 2002/01/28 17:45:19 fpmip Exp $
#
# sql-query.ipfc performs a generic SQL query on the ipfc database
# it returns an array of references to arrays
# (two-dimensional perl array)

# Author : Tycho Fruru <tycho@fruru.com>

# Copyright (C) 2001 Tycho Fruru <tycho@fruru.com>
# Copyright (C) 2001 Conostix S.A. Luxembourg - Tycho Fruru <tycho@conostix.com>

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
</%doc>

<%args>
$query
</%args>

<%perl>
use DBI;
my $dbh = $m->comp("db-connect.ipfc");
my $sth=$dbh->prepare($query);
$sth->execute or $m->abort("Query execution failed");
my @result;
while (my @current_line = $sth->fetchrow_array) {
	push @result,\@current_line;
}

$sth->finish;
#$dbh->commit;
my $rc = $dbh->disconnect;
return @result;
</%perl>
