Perl Monk, Perl Meditation | |
PerlMonks |
Re: prepare statement within DBIby grinder (Bishop) |
on Aug 25, 2004 at 15:42 UTC ( [id://385710]=note: print w/replies, xml ) | Need Help?? |
I could combine the two sql statements into one statement Well, you could with a union:
... but you must add something to each select (here, the name of the table as a string) to what is returned in order to guarantee that you can determine which count(*) corresponds to which table. You never know which order they'll come back in. But now you have just about as much make-work code to pick the apart the result set and get what you want. My advice would be to encapsulate it in a sub and use cached prepares.
Error checking is left as an exercise to the reader. - another intruder with the mooring of the heat of the Perl
In Section
Seekers of Perl Wisdom
|
|