Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: sql query subroutine check

by chromatic (Archbishop)
on Mar 01, 2003 at 21:35 UTC ( #239765=note: print w/replies, xml ) Need Help??


in reply to sql query subroutine check

You can simplify parameter fetching substantially.

my ($cmd, @place_holders) = @_;

That doesn't explicitly stringify the place holders, but I'm not sure it's necessary in your code. You don't need the double quotes around variables-as-arguments in connect(), either, unless you're doing something really complicated. (My guess is that you're not.)

Be cautious with your return. In scalar context, since it's an array, you'll get the number of elements in the array. This may or may not be what you want.

Connecting and disconnecting on every pass through the sub can be expensive.

You may want to use Carp instead of die for error messages. It can be a bit friendlier.

Replies are listed 'Best First'.
Re: Re: sql query subroutine check
by maksl (Pilgrim) on Mar 01, 2003 at 22:10 UTC
    thanks for your thoughts chromatic i'll take them in account :))
    i have already fallen under the trap you mentioned (getting the numbers of the return array and not the expected values) .. son now i'm more cautious
    the above is not under heavy load .. it's for a friend .. doing it in freetime

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-05-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?