/[SQLSession]/trunk/share/web/templates/csv
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/share/web/templates/csv

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (show annotations)
Wed Apr 11 21:09:52 2007 UTC (17 years, 1 month ago) by dpavlin
File size: 587 byte(s)
added CSV export of results
1 <%args>
2 </%args>
3 <%init>
4
5 my $query = Jifty->web->new_action(
6 class => 'DoSQL',
7 moniker => 'csv',
8 arguments => { %ARGS },
9 );
10
11 $query->run or die "can't DoSQL";
12 my $sth = $query->result->content('sth') or die "no sth in result->content?";
13
14 use Data::Dump qw/dump/;
15 warn "sth = ", dump( $sth );
16
17 my @out;
18
19 if ($sth) {
20
21 push @out, join(",", map { "\"$_\"" } @{ $sth->{'NAME'} } );
22
23 while ( my @row = $sth->fetchrow_array() ) {
24 push @out, join(",", map { "\"$_\"" } @row );
25 }
26
27 }
28
29 Jifty->handler->apache->content_type('text/csv; charset=utf-8');
30
31 </%init>
32 <% join("\r\n", @out) |n %>

  ViewVC Help
Powered by ViewVC 1.1.26