--- sql2xls.cgi 2008/11/03 18:31:58 5 +++ sql2xls.cgi 2008/11/03 18:44:42 6 @@ -83,7 +83,7 @@ # 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; @@ -91,7 +91,8 @@ while() { 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; @@ -128,7 +129,7 @@ } $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++) {