Question/problem
Bob Kleemann
rkleeman at energoncube.net
Fri Jul 20 12:36:25 CDT 2001
~sdpm~
On Fri, 20 Jul 2001, Joel Fentin wrote:
> ~sdpm~
> The following snippet is to stick around until rl = 0. It lies and passes
> through even though rl = 1. I've tried many ways to do this. They all lie.
>
> At the meeting, someone suggested FINISH. I have not found a way to use
> FINISH that doesn't bomb.
finish only works on statement handles. To get a statement handle for the
code you are using below, you'd want to do the following:
my $sth = $dbh->prepare("UPDATE $TableName SET rl = ? WHERE ID = ?");
$sth->execute(0, $ID);
$sth->finish();
And for the select it would look like:
my $sth = $dbh->prepare("SELECT COUNT(*) FROM $TableName WHERE ID = ? AND !rl");
$sth->execute($ID);
my ($rv) = $sth->fetchrow_array();
$sth->finish();
Of course I'd only recommend making these changes if you need/want the
extra functionality/error handling that can be achieved with them.
Otherwise I'd stick with your method witht the change noted below.
> ==========================
>
> my ($rv);
> $dbh->do("UPDATE $TableName SET rl = 0 WHERE ID = $ID");#reset rl
> do
> {
Put parenthesis around the $rv in this statement:
($rv) = $dbh->selectrow_array("...");
If you don't then $rv is going to have the number of elements in the array
that selectrow_array returned.
> $rv = $dbh->selectrow_array("SELECT COUNT(*) FROM $TableName WHERE ID =
> $ID AND !rl");# examine rl
> }
> until $rv;
> }
>
> --
> Joel Fentin tel: 760-749-8863 FAX: 760-749-8864
>
> email: joel at fentin.com web: Fentin.com
>
~sdpm~
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
unsubscribe san-diego-pm-list
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm
mailing list