/[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

Contents of /to_csv.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Tue Jul 18 08:24:39 2000 UTC (23 years, 8 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 #!/usr/local/bin/perl -w
2
3 # 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 use DBI;
11
12 my $sql_where;
13
14 if (defined($ARGV[0])) {
15 $sql_where = " and datum_unesen > '$ARGV[0]'";
16 }
17
18 my $mydbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;
19 $mysth = $mydbh->prepare("
20 select ime,prezime,alias||'\@pliva.hr' as email from osobe,e_mail where e_mail.osoba_id=osobe.id $sql_where
21 ") || die $mydbh->errstr();
22 $mysth->execute() || die $mysth->errstr();
23
24 print "#",join(",",@{ $mysth->{NAME} }),"\n";
25 while (@myarr = $mysth->fetchrow_array() ) {
26 print join(",",@myarr),"\n";
27 }

  ViewVC Help
Powered by ViewVC 1.1.26