DBD-CSV

 view release on metacpan or  search on metacpan

lib/DBD/CSV.pm  view on Meta::CPAN

require DynaLoader;
require DBD::File;
require IO::File;

our @f_SHORT = qw( class file dir dir_search ext lock lockfile schema encoding );
our @c_SHORT = qw( eof
	eol sep_char quote_char escape_char binary decode_utf8 auto_diag
	diag_verbose blank_is_undef empty_is_undef allow_whitespace
	allow_loose_quotes allow_loose_escapes allow_unquoted_escape
	always_quote quote_empty quote_space escape_null quote_binary
	keep_meta_info callbacks );

package DBD::CSV;

use strict;

our @ISA         = qw( DBD::File );

our $VERSION     = "0.62";
our $ATTRIBUTION = "DBD::CSV $DBD::CSV::VERSION by H.Merijn Brand";

t/82_free_unref_scalar.t  view on Meta::CPAN

	FetchHashKeyName => "NAME_lc",
	}) or die "$DBI::errstr\n" || $DBI::errstr;

    my %tbl = map { $_ => 1 } $dbh->tables (undef, undef, undef, undef);

    is ($tbl{$_}, 1, "Table $_ found") for qw( tmp );

    my %data = (
	tmp => {		# t/tmp.csv
	    1 => "ape",
	    2 => (grep (m/^csv_callbacks$/ => keys %opts) ? "new world monkey" : "monkey"),
	    3 => "gorilla",
	    },
	);

    foreach my $tbl (sort keys %data) {
	my $sth = $dbh->prepare ("select * from $tbl");
	$sth->execute;
	while (my $row = $sth->fetch) {
	    is ($row->[1], $data{$tbl}{$row->[0]}, "$tbl ($row->[0], ...)");
	    }

t/82_free_unref_scalar.t  view on Meta::CPAN

    }

sub new_world_monkeys {
    my ($csv, $data) = @_;

    $data->[1] =~ s/^monkey$/new world monkey/;

    return;
    }

my $callbacks = {
    csv_callbacks => {
	after_parse => \&new_world_monkeys,
	},
    };

test_with_options (
    csv_tables => { tmp => { f_file => "tmp.csv"} },
    %$callbacks,
    );

test_with_options (
    csv_auto_diag => 0,
    %$callbacks,
    ) for (1 .. 200);

done_testing ();



( run in 0.323 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )