RE: Signal Handling
From: Timothy Helck (Timothy.Helck_at_bowker.com)
Date: 12/16/03
- Next message: Ian Harisay: "Refreshing a database from another"
- Previous message: Mahtaj Khamneian: "RE: Signal Handling"
- Maybe in reply to: Mahtaj Khamneian: "Signal Handling"
- Next in thread: Mahtaj Khamneian: "RE: Signal Handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Dec 2003 14:04:14 -0500 To: "Khamneian, Mahtaj" <khamneianm@umsystem.edu>, <dbi-users@perl.org>
I'm not able to reproduce your results.
Does ctrl-C kill the perl process and leave the select running, or does it fail to kill the perl?
Does ctrl-C work if you change any of the following?
remove sleep()
remove distinct from the query
replace dump_results() with bind_columns() and fetch()
-----Original Message-----
From: Khamneian, Mahtaj [mailto:khamneianm@umsystem.edu]
Sent: Tuesday, December 16, 2003 11:36 AM
To: dbi-users@perl.org
Subject: RE: Signal Handling
Thanks for the reply.
I have tried a slight variation of what you've suggested, but it seems, the db operation is not cancelled as a result of hitting
CTRL-C-- I have to kill the process manually to stop the program.
Here's a snippet of the program:
...
sub kill_me{my $key = shift; die "\n\n\tKilled:$key\n\n";}
$SIG{INT} = \&kill_me;
DBI->trace (0);
# connect to target db
my $dbh = DBI->connect ("dbi:Oracle:$sid", $user, $password)
or die "Can't connect to database: $DBI::errstr\n";
my $sth = $dbh->prepare( "select distinct sid, status, client_info, b.name, b.emailid from
v\$session, ps_um_employees b where substr(client_info,1,(instr(client_info,',')-1))=b.mang
led_sso (+) and status='ACTIVE'" );
while (1) {
$sth->execute();
my $rows = $sth->dump_results();
sleep(5);
}
$dbh->disconnect;
exit 0;
> -----Original Message-----
> From: Helck, Timothy [mailto:Timothy.Helck@bowker.com]
> Sent: Tuesday, December 16, 2003 7:51 AM
> To: Khamneian, Mahtaj; dbi-users@perl.org
> Subject: RE: Signal Handling
>
>
> I'm not sure if this is what you have in mind:
>
> sub kill_me{my $key = shift; die "\n\n\tKilled:$key\n\n";}
> $SIG{INT} = \&kill_me;
>
> This will kill the Perl process and (I think) any child processes.
>
>
> -----Original Message-----
> From: Khamneian, Mahtaj [mailto:khamneianm@umsystem.edu]
> Sent: Monday, December 15, 2003 4:17 PM
> To: dbi-users@perl.org
> Subject: Signal Handling
>
>
> Has anyone been able to successfully implement CTRL-C signal
> handling in Perl DBI?
> If so, I'd appreciate an example.
>
> -------------------------------------
> Mahtaj Khamneian
> University of Missouri - ASP Phone : (573) 884-2281
> 1805 East Walnut Fax : (573)
> 884-3070
> Columbia, MO 65201-6425 khamneianm@missouri.edu
> I wish I were able to create a program that could ping my mind.
> I would then load it into the creation's/nature's server, for which
> no root access is needed, and invoke it via cron at spontaneous
> intervals.
>
>
- Next message: Ian Harisay: "Refreshing a database from another"
- Previous message: Mahtaj Khamneian: "RE: Signal Handling"
- Maybe in reply to: Mahtaj Khamneian: "Signal Handling"
- Next in thread: Mahtaj Khamneian: "RE: Signal Handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|