Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

difference between syb_nsql and prepare/execute call

by perl@1983 (Sexton)
on Nov 08, 2010 at 20:17 UTC ( #870185=perlquestion: print w/ replies, xml ) Need Help??
perl@1983 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am using DBI and DBD::Sybase to connect to Sybase database. I have seen that to execute a SQL statement or make a stored proc call, some of the programmers use syb_nsql ($SQL,"HASH") like method while some use prepare($SQL), $sth->execute() syntax. I was wondering what is the difference between those two? Which one is better? Thanks

Comment on difference between syb_nsql and prepare/execute call
Re: difference between syb_nsql and prepare/execute call
by TomDLux (Vicar) on Nov 08, 2010 at 21:03 UTC

    I always use prepare(), execute(), or at least selectall_hashref().

    What does the DBD-Sybase documentation say?

    As Occam said: Entia non sunt multiplicanda praeter necessitatem.

Re: difference between syb_nsql and prepare/execute call
by sundialsvc4 (Monsignor) on Nov 09, 2010 at 03:57 UTC

    I would guess that the former is some kind of low-level call that is specific to Sybase, whereas the second is “ordinary DBI syntax.”   As others have suggested, look at the DBD driver documentation.   If the programmers that you speak of are available, go and ask them.

      Thanks for the reply. Unfortunately, the programmers I asked didn't have much clarity on this as well. :(
Re: difference between syb_nsql and prepare/execute call
by elwarren (Curate) on Nov 09, 2010 at 16:57 UTC

    If you prepare() then execute(), you have the option of executing the same statement multiple times without preparing again. A simple optimization that can add up when updating many records.

    The syb_nsql combines these steps into one, as well as offering additional functionality with callbacks. Docs cover this better than I can explain it.

      I already checked the documentation at cpan, but could not understand clearly. So, do you mean to say that syb_nsql is better?
        I don't know about you, but I read that as saying there are trade-offs.
Re: difference between syb_nsql and prepare/execute call
by mpeppler (Vicar) on Nov 10, 2010 at 14:58 UTC
    syb_nsql() was added to provide a compatible call with Sybase::CTlib and Sybase::DBlib, and to simplify porting perl code between the two. The call was added at the request of a rather large organization that uses a lot of perl/Sybase :-)

    Personally I use prepare/execute/fetch...

    Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://870185]
Approved by aquarium
Front-paged by aquarium
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2014-08-01 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (33 votes), past polls