/[informatika.old]/fill-podjela.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 /fill-podjela.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Apr 12 08:11:45 2000 UTC (22 years, 7 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
.

1 #!/usr/local/bin/perl -w
2
3 use DBI;
4
5 #---
6
7 my $pgdbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;
8 open(IN,"podjela.txt") || die "ne mogu otvoriti: $!";
9 while (<IN>) {
10 chomp;
11 s/\015//g; # kill cr
12
13 tr/šðžèæŠÐŽÈÆ/¹ð¾èæ©Ð®ÈÆ/; # 1250 -> iso8859-2
14
15 $data=$_;
16
17 if ($data !~ /^\t/) {
18 $sth=$pgdbh->prepare('insert into org_jed (naziv) values (?)');
19 $sth->execute($data);
20 } else {
21 $data =~ s/^\t//;
22 $sth=$pgdbh->prepare("select last_value from org_jed_id_seq");
23 $sth->execute;
24 @arr = $sth->fetchrow_array;
25 $sth=$pgdbh->prepare("insert into org_pod_jed (nad_id,pod_naziv) values (?,?)");
26 $sth->execute($arr[0],$data);
27
28 }
29
30 }
31
32 print "\n";

  ViewVC Help
Powered by ViewVC 1.1.26