The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

DBIx::Browse - Module to browse related tables.
(c) Copyright 2000 Evilio José del Río Silván <edelrio@icm.csic.es>


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
any later version.

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.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.



Description
-----------

DBIx::Browse is a module to facilitate the browsing (INSERT,
UPDATE and DELETE) of related database tables.

Build and Install
-----------------

All you have to do to build, test and install this stuff, if your
connected to the Internet, is:

perl Makefile.PL
make
make test
make install

NOTE: To perform all tests, including inserting, updating and deleting
some rows, you need to set two environment variables:

DBI_DSN	: The DBI(3) default Data Source Name (see DBI(3)).

DBIX_BROWSE_MAKE_TEST : If set to some true value, the tests will be performed.

These tests expect to find in the databese pointed by DBI_DSN two
tables as described by the examples/test.psql. This file is written in
Postgres dialect but can be adapted easily to others. Be careful since
the operations performed by the test could destroy some valuable
information (that's why I require a special environment variable to be
set before connecting to DBI).

Usage Overview
--------------


         use DBIx::Browse;
         my ($dbh, $dbb, $q);
         $dbh = DBI->connect("DBI:Pg:dbname=enterprise")
           or croak "Can't connect to database: $@";
        $dbb = new  DBIx::Browse({
           dbh => $dbh,
           table => 'employee',
           proper_fields => [ qw ( name fname ) ],
           linked_fields => [ qw ( department category office ) ],
           linked_tables => [ qw ( department category office ) ],
           linked_values => [ qw ( name       name     phone  ) ],
           linked_refs   => [ qw ( id         id       id    ) ],
           aliases       => [ qw ( name fname department category phone )],
           primary_key   => 'id'
       });


       $my $sth = $db->prepare({
	 where => "departament = 'Adminitstration' AND age < 35",
         order => "name ASC, departament ASC"
	}

       
       $dbb->insert({
	 name => 'Doe',
         fname => 'John',
	 department => 'Sales',
	 category   => 'Sales representatn',
	 phone      => '1114'
	});

	$dbb->update({
	   category => 'Sales manager',
	   phone => '1113'
	},
	" id = 1 "
	);


       ...etc



Examples
--------

See the directory examples and the test.pl script in this distribution.


Author
------

Evilio José del Río Silván <edelrio@icm.csic.es>