package PXSQL::EXSQL::ARTICLE;
#------------------------------------------------------------------------------
# Project  : Perl XSQL
# Name     : ARTICLE.pm
# Language : 5.005_03 built for i386-linux
# OS       : linux RedHat 6.2 kernel 2.2.14-5.0smp
# Author   : Gilles Darold, gilles __AT__ darold __DOT__ net
# Copyright: Copyright (c) 2000 : Gilles Darold
# Function : Extended SQL queries
# Usage    : See documentation.
#------------------------------------------------------------------------------
# Version control :
# $Id$
#------------------------------------------------------------------------------

BEGIN {
    use Exporter();
    use vars qw($VERSION @ISA @EXPORT);

    # Set all internal variable
    $VERSION = '1.0';
    @ISA = qw(Exporter);
    @EXPORT = qw/	
			get_item_customer
		/;
}

use strict qw/vars sub/;


=head1 NAME

ARTICLE - A perl module for building Extended XML / SQL query

=head1 SYNOPSIS

use ARTICLE;


=head1 DESCRIPTION

This module is used to demonstrate how to extend the capability
of the perl XSQL tool.

All methods defined into an extended module must be exported
(see BEGIN method)

=head1 METHODS

=head1 get_item_customer

Here we suppose that the id of an item correspond to the
id of a customer. This is completly wrong but we don't care

=cut

sub get_item_customer
{
	my ($self, $cgi, @ret) = @_;

        my $item = $cgi->param('id');

        push( @ret, [ ('ARTICLES', 'ROW', "
                SELECT *
                FROM article
                WHERE id = $item
        ") ] );

        push( @ret, [ ('CUSTOMER', 'ROW', "
                SELECT *
                FROM customer
                WHERE id = $item
        ") ] );

        @ret;
}

1;

__END__
