mysql DBI

Tony Bowden tony at kasei.com
Sat Aug 25 16:39:38 CDT 2001


On Sat, Aug 25, 2001 at 06:18:09PM +0000, Scott McWhirter wrote:
> this is more a 'what would you do' question than anything else. I'm 
> wondering... What's the best way to get back multiple fields in muliple rows 
> from a table. An example would be well appreciated.

Use an abstraction layer, such as the wonderful Class::DBI::mysql -

  package Foo::Tablename;
  __PACKAGE__->set_db('Main', @dbi_connect_info);
  __PACKAGE__->set_up_table('tablename');

  1;

  package main;

  use Class::DBI::mysql;
    
  foreach my $row (Foo::Tablename->search(wibble => 'bar')) {
    print $row->wibble, $row->some_other_column, $row->etc;
  }

Tony

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/belfast-pm/attachments/20010825/f2c4864e/attachment.bin


More information about the Belfast-pm mailing list