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

Annotation of /to_csv.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Jul 18 08:24:39 2000 UTC (22 years, 6 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +15 -2 lines
File MIME type: text/plain
datum od kojeg počinje export

1 dpavlin 1.1 #!/usr/local/bin/perl -w
2    
3 dpavlin 1.2 # export e-mail adresa za Filipa,
4     # Usage:
5     #
6     # to_csv.pl [yyyy-mm-dd]
7     #
8     # yyyy-mm-dd ... datum od kojeg se vrši export (datum zadnjeg exporta)
9    
10 dpavlin 1.1 use DBI;
11    
12 dpavlin 1.2 my $sql_where;
13    
14     if (defined($ARGV[0])) {
15     $sql_where = " and datum_unesen > '$ARGV[0]'";
16     }
17    
18 dpavlin 1.1 my $mydbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;
19     $mysth = $mydbh->prepare("
20 dpavlin 1.2 select ime,prezime,alias||'\@pliva.hr' as email from osobe,e_mail where e_mail.osoba_id=osobe.id $sql_where
21 dpavlin 1.1 ") || die $mydbh->errstr();
22     $mysth->execute() || die $mysth->errstr();
23    
24 dpavlin 1.2 print "#",join(",",@{ $mysth->{NAME} }),"\n";
25 dpavlin 1.1 while (@myarr = $mysth->fetchrow_array() ) {
26     print join(",",@myarr),"\n";
27     }

  ViewVC Help
Powered by ViewVC 1.1.26