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

Diff of /fill.pl

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

revision 1.2 by dpavlin, Mon Jun 19 06:03:23 2000 UTC revision 1.3 by dpavlin, Fri Jan 25 14:47:43 2002 UTC
# Line 10  $type=~s/\.[^\.]+//g; Line 10  $type=~s/\.[^\.]+//g;
10    
11  #---  #---
12    
13  my $mydbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;  my $dbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;
14  open(IN,"< $file") || die "ne mogu otvoriti $file";  open(IN,"< $file") || die "ne mogu otvoriti $file";
15  while (<IN>) {  while (<IN>) {
16          chomp;          chomp;
# Line 53  while (<IN>) { Line 53  while (<IN>) {
53                          $passwd=$passwd.$ch;                          $passwd=$passwd.$ch;
54                  }                  }
55                  $sql_insert="insert into kontakt_osobe (ime,prezime,e_mail,passwd,prava) values ('$arr[0]','$arr[1]','$arr[2]','$passwd',64) ";                  $sql_insert="insert into kontakt_osobe (ime,prezime,e_mail,passwd,prava) values ('$arr[0]','$arr[1]','$arr[2]','$passwd',64) ";
56            } elsif ($type eq "sap2informatika") {
57                    next if ($arr[2] eq "");
58                    $sql_insert="insert into sap2orgjed values ('$arr[0]','$arr[1]','$arr[2]')";
59          } else {          } else {
60                  die "Nepoznat tip datoteke $type !!";                  die "Nepoznat tip datoteke $type !!";
61          }          }
62    
63          print "--$sql_insert\n";          print "--$sql_insert\n";
64          $mydbh->do("$sql_insert") || die $mydbh->errstr();          $dbh->do("$sql_insert") || die $dbh->errstr();
65    
66  }  }
67    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26