NAME
Text::CSV::Auto::ExportTo::MySQL - Export a CSV file to MySQL.
SYNOPSIS
use Text::CSV::Auto;
use Text::CSV::Auto::ExportTo::MySQL;
my $auto = Text::CSV::Auto->new('path/to/file.csv');
my $exporter = Text::CSV::Auto::ExportTo::MySQL(
auto => $auto,
connection => $dbh,
);
Or a simpler interface can be used:
$auto->export_to_mysql(
connection => $dbh,
);
DESCRIPTION
This module provides the ability to export a CSV file straight in to MySQL without much fuss.
Note that if the table already exists it will be dropped.
ATTRIBUTES
auto
The Text::CSV::Auto instance to copy headers and rows from. Required.
connection
Can be either a DBIx::Connector (recommended) or a DBI handle. DBIx::Connector is recommended as it provides a robust connection and transation management layer on top of DBI. Required.
table
The table name to export to. Defaults to a nicely formatted version of the CSV's file name.
method
If using DBIx::Connector for the connection then this states what method to use such as "run", "txn", or "svp". Defaults to "svp" which degrades well on non-transactional databases.
mode
If using DBIx::Connector for the connection this this dictates what connection mode to use such as "ping", "fixup", and "no_ping". The default is "fixup".
create_sql
Returns the SQL that will be used to CREATE the table.
METHODS
export
$exporter->export();
Exports the CSV data to MySQL.
AUTHOR
Aran Clary Deltac <bluefeet@gmail.com>
LICENSE
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.