Notromda has asked for the wisdom of the Perl Monks concerning the following question:
When using DBI, is it safe to do a comparison like:
This feels like an error to me, though I can't prove why. Of course, I would prefer:if (! $sth->fetchrow_array()) { #no rows returned } else { # rows returned }
I just would like to know if and why the first might be producing a bug in a program.if ( $sth->rows() == 0 ) { #no rows returned }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: fetchrow_array return value
by mpeppler (Vicar) on Jan 10, 2004 at 00:05 UTC | |
Re: fetchrow_array return value
by exussum0 (Vicar) on Jan 10, 2004 at 00:46 UTC | |
Re: fethrow_array return value
by zby (Vicar) on Jan 09, 2004 at 23:37 UTC | |
by Notromda (Pilgrim) on Jan 10, 2004 at 00:17 UTC | |
by Roger (Parson) on Jan 10, 2004 at 01:03 UTC | |
by runrig (Abbot) on Jan 10, 2004 at 02:13 UTC | |
by Roger (Parson) on Jan 10, 2004 at 03:05 UTC | |
by ysth (Canon) on Jan 11, 2004 at 06:07 UTC |
Back to
Seekers of Perl Wisdom