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; |
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 |
|
|