To use different separators, delimters, or escapes, use DBD::CSV's csv_tables, for example for a so-called "Tab Delimted" file with *nix line endings:
If you omit the csv_tables defintion, then the table name will be used for the filename and the separator will be a comma, the delimiter a quote mark and the line ending windows-style '\015\012'.$dbhC->{csv_tables}->{outTable} = { file => 'foo/bar.csv', sep_char => "\t", eol => '\012', };
#!/usr/bin/perl use warnings; use strict; use DBI; my $dbhX = DBI->connect('dbi:XBase(RaiseError=1):'); my $dbhC = DBI->connect('dbi:CSV(RaiseError=1):'); my $select = $dbhX->prepare("SELECT * FROM inTable"); $select->execute(); $dbhC->do("CREATE TABLE outTable AS IMPORT(?)",{},$select); __END__
|
|---|