Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: using has_selected_record() of Net::MySQL

by critter (Acolyte)
on Aug 11, 2005 at 11:54 UTC ( [id://482916] : note . print w/replies, xml ) Need Help??


in reply to using has_selected_record() of Net::MySQL

Hi,

Maybe you can check on how many records you get returned. The CPAN pages mentions the next function:

my $affected_rows = $mysql->get_affected_rows_length;

I'm guessing that the has_selected_record returns always true because it can be run and will always return a value. I've never used this module but you could check and see what you get as return value. If this is a number you could change your check a bit perhaps to:

if ( $mysql->has_selected_record > 1 ) { #do something; } else { #do something else }

Just my 2 cents,

Grtz,

Critter

Replies are listed 'Best First'.
Re^2: using has_selected_record() of Net::MySQL
by ranjan_jajodia (Monk) on Aug 11, 2005 at 13:39 UTC
    Hi,
    get_affected_rows_length() will work only in case of 'update queries'. In 'select queries it will always return zero.
    has_selected_record() returns true or false as written in the specifications at CPAN.

    Thanks for the effor though :-),
    Ranjan

    --Let Logic Rule--