31 |
|
|
32 |
my $sth; |
my $sth; |
33 |
|
|
34 |
|
open(WHO,"who am i |") || die "who am i? $!"; |
35 |
|
my $db_user=<WHO>; |
36 |
|
chomp $db_user; |
37 |
|
$db_user=~s/\s.+$//g; |
38 |
|
close(WHO); |
39 |
|
|
40 |
|
open(HOSTNAME,"hostname |") || die "hostname: $!"; |
41 |
|
my $hostname=<HOSTNAME>; |
42 |
|
chomp $hostname; |
43 |
|
close(HOSTNAME); |
44 |
|
|
45 |
|
my $sth = $dbh->prepare("select ko_id from unix2ko where login='$db_user' and host='$hostname'") || die $dbh->errstr(); |
46 |
|
$sth->execute() || die $sth->errstr(); |
47 |
|
my ($ko_id)=$sth->fetchrow_array; |
48 |
|
|
49 |
#$sth = $dbh->prepare("select id from kontakt_osobe where e_mail like '%hana%'") || die $dbh->errstr(); |
#$sth = $dbh->prepare("select id from kontakt_osobe where e_mail like '%hana%'") || die $dbh->errstr(); |
50 |
#$sth->execute() || die $sth->errstr(); |
#$sth->execute() || die $sth->errstr(); |
51 |
#($kontakt_osoba_id) = $sth->fetchrow_array(); |
#($kontakt_osoba_id) = $sth->fetchrow_array(); |
106 |
while (my @arr = $sth->fetchrow_array() ) { |
while (my @arr = $sth->fetchrow_array() ) { |
107 |
print join("|",@arr),"\n"; |
print join("|",@arr),"\n"; |
108 |
|
|
109 |
$dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],3,'now'::datetime,5)") if (!$debug); |
$dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],$ko_id,'now'::datetime,5)") if (!$debug); |
110 |
|
|
111 |
seek(IN,$begin_pos,0); |
seek(IN,$begin_pos,0); |
112 |
while(<IN>) { |
while(<IN>) { |