# Add a worksheet
my $worksheet = $workbook->addworksheet($sheet_name);
- print STDERR "working on $sql_file...\n" if ($debug);
+ print STDERR "working on $sql_file\n" if ($debug);
open(SQL,$sql_file) || die "can't open sql file '$sql_file': $!";
my $comment;
while(<SQL>) {
chomp;
if (/^\\c\s+(\S+)/) {
- warn "## connect to $1\n" if $debug;
+ $dbh->disconnect if $dbh;
+ print STDERR "## connect to $1\n" if $debug;
$dbh = DBI->connect($dsn . $1,$user,$passwd, { RaiseError => 1, AutoCommit => 0 }) || die $DBI::errstr;
} elsif (/^--(.+)/) {
$comment.=$1;
}
$row++;
- my @types = map { scalar $dbh->type_info($_)->{TYPE_NAME} } @{ $sth->{TYPE} };
+ my @types = map { $dbh->type_info($_) ? $dbh->type_info($_)->{TYPE_NAME} : '?' } @{ $sth->{TYPE} };
while (my @row = $sth->fetchrow_array() ) {
for(my $col=0; $col<=$#row; $col++) {