The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Class::DBI::Plugin::RetrieveFromSQL - readable retrieve_from_sql plugin for Class::DBI

SYNOPSIS

  package Music::CD;
  use base qw(Class::DBI);
  use Class::DBI::Plugin::RetrieveFromSQL;

  package Main;
  my @cds = Music::CD->retrieve_from_sql(qq{
    (artist =    :artist OR artist2 = :artist) AND
    title  like :title  AND
    year   <=   :year
    ORDER BY year
    LIMIT 2,3
  }, {artist => 'Ozzy Osbourne', title => '%Crazy', year => 1986});

  # This does the equivalent of:
  my @cds = Music::CD->retrieve_from_sql(qq{
    (artist =   ?  OR artist2 = ?) AND
    title  like ?  AND
    year   <=   ?
    ORDER BY year
    LIMIT 2,3
  }, 'Ozzy Osbourne', 'Ozzy Osbourne', '%Crazy', 1986);

DESCRIPTION

Class::DBI::Plugin::RetrieveFromSQL makes your retrieve_from_sql more readable!

When using many arguments in retrieve_from_sql, it hardly to read. If you use this plugin, you can use the hash!

AUTHOR

MATSUNO Tokuhiro <tokuhiro at mobilefactory.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Class::DBI, ActiveRecord