/[SQL2XLS]/sql2xlsx.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sql2xlsx.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by dpavlin, Mon Mar 24 16:35:29 2008 UTC revision 4 by dpavlin, Mon Mar 24 23:02:15 2008 UTC
# Line 65  foreach my $sql_file (@sql_files) { Line 65  foreach my $sql_file (@sql_files) {
65          my $sql = "";          my $sql = "";
66          while(<SQL>) {          while(<SQL>) {
67                  chomp;                  chomp;
68                  if (/^--(.+)/) {                  if (/^\\c\s+(\S+)/) {
69                            warn "## connect to $1\n" if $debug;
70                            $dbh = DBI->connect('DBI:Pg:dbname=' . $1,$user,$passwd) || die $DBI::errstr;
71                    } elsif (/^--(.+)/) {
72                          $comment.=$1;                          $comment.=$1;
73                  } else {                  } else {
74                          $sql.=$_;                          $sql.= ' ' . $_;
75                  }                  }
76          }          }
77          close(SQL);          close(SQL);
78    
79            $sql =~ s/\s\s+/ /gs;
80    
81          print STDERR "sql: $sql\ncomment: $comment\n" if ($debug);          print STDERR "sql: $sql\ncomment: $comment\n" if ($debug);
82    
83          my $row = 0;          my $row = 0;
# Line 105  foreach my $sql_file (@sql_files) { Line 110  foreach my $sql_file (@sql_files) {
110                          my $data = $row[$col];                          my $data = $row[$col];
111                          if ( $types[$col] =~ m/^date/i ) {                          if ( $types[$col] =~ m/^date/i ) {
112                                  $data .= 'T' if $data =~ m/^\d\d\d\d-\d\d-\d\d$/;                                  $data .= 'T' if $data =~ m/^\d\d\d\d-\d\d-\d\d$/;
113                                    $data =~ s/^(\d\d\d\d-\d\d-\d\d)\s(\d\d:\S+)$/$1T$2/;
114                                    warn "## $data\n";
115                                  $worksheet->write_date_time( $row, $col, $data, $date_format );                                  $worksheet->write_date_time( $row, $col, $data, $date_format );
116                          } else {                          } else {
117                                  $worksheet->write($row, $col, _c( $data ) );                                  $worksheet->write($row, $col, _c( $data ) );

Legend:
Removed from v.3  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26