Path: usenet.cise.ufl.edu!newsfeeds.nerdc.ufl.edu!news.msfc.nasa.gov!logbridge.uoregon.edu!feed1.news.rcn.net!rcn!newsfeed.corridex.com!nntp2.savvis.net!inetarena.com!not-for-mail
From: David Lowe <[email protected]>
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules
Subject: ANNOUNCE: DBIx::Table 0.03
Date: 1 Dec 1999 15:23:08 GMT
Organization: SBC Internet Services
Lines: 90
Approved: [email protected] (comp.lang.perl.announce)
Message-ID: <[email protected]>
NNTP-Posting-Host: halfdome.holdit.com
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply approval of content.
Xref: usenet.cise.ufl.edu comp.lang.perl.announce:401 comp.lang.perl.modules:14909

Recently added to CPAN...

source here:
http://www.cpan.org/modules/by-authors/id/D/DL/DLOWE/DBIx-Table-0.03.tar.gz

homepage & online documentation here:
http://pootpoot.com/~dlowe/DBIx-Table/

----------------------------------------------------------------------------

NAME
      DBIx::Table - Class used to represent DBI database tables.

SYNOPSIS
      To make it useful:

        package SUBCLASS;
        @ISA = qw(DBIx::Table);
        sub describe {
            my($self) = shift;
            $self->{'table'}       = $table_name;
            $self->{'unique_keys'} = [ [ $column, ... ], ... ];
            $self->{'columns'}     = { $col_name => { %col_options },
                                       [ ... ]
                                     };
          [ $self->{'related'}     = { $class_name => { %relationship },
                                       [ ... ]
                                     }; ]
        }


      To use the useful object:

        $table = load SUBCLASS( db      => $dbi_object,
                              [ where   => { $column => $value, ... }, ]
                              [ columns => [ $column1, $column2 ], ]
                              [ index   => $index, ]
                              [ count   => $count, ]
                              [ groupby => $groupby, ]
                              [ orderby => ['+'|'-'] . $column ]);
        $table = create SUBCLASS( db => $dbi_object);

        $new_table  = $table->load_related( type => $classname,
                                            row  => $row,
                                          [ %where_arguments ] );
        $num_rows   = $table->num_rows();
        $query_rows = $table->query_rows();
        $columns    = $table->columns();
        $db         = $table->db();
        $level      = $table->debug_level( [ level => $level ] );
        $value      = $table->get( column => $column, [ row => $row ] );
        $retval     = $table->set( change => { $column => $value, [ ..., ] },
                                   [ row => $row ] );
        $retval     = $table->refresh( columns = [ $column1, $column2 ],
                                       [ row => $row ] );
        $retval     = $table->commit( [ row => $row ] );
        $retval     = $table->remove( [ row => $row ] );
        $count      = $table->count( [ where => { $column => $value, ... } ]


DESCRIPTION
      DBIx::Table is a class designed to act as an abstraction
      layer around a fairly large subset of SQL queries.  It is
      called 'Table' because it is primarily designed such that
      a single subclass provides an object-oriented interface to
      a single database table.  The module is flexible enough,
      though, that it can be used to abstract most any schema in
      a way that is comfortable to the perl coder who is not
      familiar with the underlying schema, or even SQL.

      As the synopsis above points out, this class is not useful
      when simply used by itself.  Instead, it should be
      subclassed.  The subclass follows a particular syntax for
      describing the structure of the table, which the Table
      module uses internally to control its behavior.

      The subclass can then be used to access the underlying
      data, with the Table module taking care of writing the
      actual SQL.  The current version can write SELECT, UPDATE,
      INSERT and DELETE statements.  Depending on the complexity
      of the definition, it can also do joins across multiple
      tables and intelligently load related table objects.


: : : J. David Lowe :: [email protected] :: http://pootpoot.com : : :
:   "The secret to happiness is short-term, stupid self-interest!"   :
:                                - Calvin, /Calvin and Hobbes/       :
:: fingerprint: 79 1D 66 9F 35 A1 2D ED   81 98 26 E1 F8 D5 3F 29 ::