Class-Classless-DBI

 view release on metacpan or  search on metacpan

lib/Class/Classless/DBI.pm  view on Meta::CPAN

      columns => {foo => 'id'}
    }
  );

This key applies to the values key for C<insert_into_table> and the where key
for the other methods.

=head3 group

This key applies only to C<select_from_table>. Its value should be an arrayref
containing the names of columns by which to group results.

=head3 values

This key applies to the methods C<insert_into_table> and C<update_table>. Its
value should be a hashref containing (column_name => value) entries. For
C<insert_into_table> it may also be an arrayref containing several hashrefs. In
that case, each hashref must contain the same number of columns. Column values
may also be arrayrefs, in which case a row will be inserted for each element of
the referenced array.

=head3 select

This key applies only to C<select_from_table>. Its value should be an arrayref
containing the names of columns to select from the table.

=head3 where

This key applies to all methods but C<insert_into_table>. Its value should be a
hashref or an arrayref containing hashrefs. Each hashref should contain
(column_name => value) entries that should all be satisfied for one row. An
empty hashref will match all rows. All rows that match any of the hashrefs
will be used. If the arrayref is empty, then no rows will be matched. However,
if where is undefined, all rows will be matched. In order to simplify some
queries, column values may also be arrayrefs, in which case rows that match any
element of the referenced array will be used. For example, the following two
queries are identical.

  $dbo->select_from_table(
    {
      where => [
        {id => 5, val => 6},
        {id => 5, val => 7},
        {id => 6, val => 6},
        {id => 6, val => 7}
      ]
    }
  );

  $dbo->select_from_table(
    {
      where => {id => [5,6], val => [6,7]}
    }
  );

=head2 C<make_where_clause>

=head2 C<make_from_clause>

These methods are used internally by the previous methods but are also available
for public use. They generate fragments of SQL queries to be used with
L<SQL::Interpolate>. C<make_where_clause> expects the where key to be present in
the same format as specified above. C<make_from_clause> expects a key named from
in the same format as values in a C<insert_into_table> method call. Both accept
the columns key as well.

=head1 AUTHOR

Mark Tiefenbruck <mdash@cpan.org>

=head1 LEGAL STUFF

Copyright (c) 2005, Mark Tiefenbruck. All rights reserved. This module is free
software. It may be used, redistributed and/or modified under the same terms as
Perl itself.

=head1 SEE ALSO

  L<Class::Classless>
  L<DBIx::Interpolate>
  L<Class::DBI>



( run in 0.844 second using v1.01-cache-2.11-cpan-364913b4093 )