Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: using has_selected_record() of Net::MySQL

by critter (Acolyte)
on Aug 11, 2005 at 11:54 UTC ( #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--

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2023-12-11 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?