holli has asked for the wisdom of the Perl Monks concerning the following question:
[% USE DBI('dbi:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/pr +ojekte/vdx/daten/users.mdb', '', '') -%] [% FOREACH user = DBI.query( 'SELECT * FROM users' ) -%] [% user.id %] [% user.name %] [% END -%]
use strict; use warnings; use DBI; use DBD::CSV; my $dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;}); $dbh->{'csv_tables'}->{'users'} = { 'file' => 'c:/projekte/vdx/daten/users.txt', 'col_names' => ["id", "name"] }; my $sth = $dbh->prepare("SELECT * FROM users"); $sth->execute; while( my $row = $sth->fetchrow_hashref ) { print $row->{id}, ";", $row->{name}, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using DBD::CSV with Template::Plugin::DBI
by jZed (Prior) on Aug 25, 2005 at 16:41 UTC | |
by holli (Abbot) on Aug 26, 2005 at 10:19 UTC | |
by jZed (Prior) on Aug 26, 2005 at 16:03 UTC |