Thread Problem mit DBD::CSV: SELECT * FROM ... bring kein Ergebnis (7 answers)
Opened by format_c at 2004-03-20 20:14

Ronnie
 2004-03-21 19:28
#31861 #31861
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
Die 'col_names' scheinen wichtig zu sein. Nochmal komplett:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
use strict;
use warnings;
use DBI;

# Declare variables
my $db = 'C:/Perlen/csv';
my $prefix = '+49';

# Makes a Datebase Handler
my $dbh = DBI->connect("DBI:CSV:f_dir=$db") or die DBI::errstr;
$dbh->{csv_tables}->{phonebook} =
{
'file' => 'test.csv',
'col_names' => ["ID", "Nummer", "Vorname", "Nachname"],
};


my $sql = qq|
SELECT * FROM phonebook
|;

my $sth = $dbh->prepare( $sql ) or die $dbh->errstr;
$sth->execute() or die $dbh->errstr;
while (my @row = $sth->fetchrow_array()) {
print join "\t", @row;
print "\n";
}

$sth->finish();
$dbh->disconnect();

exit;
\n\n

<!--EDIT|Ronnie|1079890178-->

View full thread Problem mit DBD::CSV: SELECT * FROM ... bring kein Ergebnis