Thread DBD-CSV und whitespaces??? (12 answers)
Opened by Andreas at 2003-11-04 11:32

havi
 2003-11-04 12:19
#69128 #69128
User since
2003-08-04
2036 Artikel
BenutzerIn
[Homepage]
user image
Funzt doch !?

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
#!/usr/bin/perl

use warnings;
use strict;
use DBI;

my $dbh = DBI->connect("DBI:CSV:f_dir=csvdb") or die "Cannot connect: " . $DBI::errstr;

$dbh = DBI->connect("DBI:CSV:");
$dbh->{'csv_tables'}->{'index'} = {
                                   sep_char     => " ",
                                   quote_char   => undef,
                                   eol          => undef,
                                   escape_char  => undef,
                                   always_quote => 0,
                                   file => 'test.txt',
                                   col_names => ["pos", "qnt", "part", "housing"]
                                 };

my $sth = $dbh->prepare("SELECT * FROM index");
$sth->execute() or die "Cannot execute: " . $sth->errstr();

while (my @ausgabe = $sth->fetchrow_array) {
print $ausgabe[0]."\t".$ausgabe[1]."\n";
} # while

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

1;


Gruss\n\n

<!--EDIT|havi|1067941214-->

View full thread DBD-CSV und whitespaces???