DBD::CSV: Append-extension-question
- by sid_com
Why does only the second example append the extension to the filename and what is the "/r" in ".csv/r" for.
#!/usr/bin/env perl
use warnings; use strict;
use 5.012;
use DBI;
my $dbh = DBI->connect( "DBI:CSV:f_dir=/home/mm", { RaiseError => 1, f_ext => ".csv/r"} );
my $table = 'new_1';
$dbh->do( "DROP TABLE IF EXISTS $table" );
$dbh->do( "CREATE TABLE $table ( id INT, name CHAR, city CHAR )" );
my $sth_new = $dbh->prepare( "INSERT INTO $table( id, name, city ) VALUES ( ?, ?, ?, )" );
$sth_new->execute( 1, 'Smith', 'Greenville' );
$dbh->disconnect();
# --------------------------------------------------------
$dbh = DBI->connect( "DBI:CSV:f_dir=/home/mm", { RaiseError => 1 } );
$dbh->{f_ext} = ".csv/r";
$table = 'new_2';
$dbh->do( "DROP TABLE IF EXISTS $table" );
$dbh->do( "CREATE TABLE $table ( id INT, name CHAR, city CHAR )" );
$sth_new = $dbh->prepare( "INSERT INTO $table( id, name, city ) VALUES ( ?, ?, ?, )" );
$sth_new->execute( 1, 'Smith', 'Greenville' );
$dbh->disconnect();