Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Re: Re: using sequences with dbi

by BigJoe (Curate)
on Oct 04, 2001 at 00:56 UTC ( #116569=note: print w/replies, xml ) Need Help??

in reply to Re: Re: using sequences with dbi
in thread using sequences with dbi

Not to be rude, but why make it more complicated than it is? I have read the links and it looks to like it is mostly personal opinion. When it is something simple and quick I don't use place holders. When it is complicated from the begining then I use place holders. But again that is my personnal opinion.


Learn patience, you must.
Young PerlMonk, craves Not these things.
Use the source Luke.

Replies are listed 'Best First'.
Re: Re: Re: Re: using sequences with dbi
by tommyw (Hermit) on Oct 04, 2001 at 01:09 UTC

    Because, at the very least, if you run the same program with different parameters, then multiple statements are sent to the server, with different text. This means they have to be reparsed.

    If you use placeholders, then, irrespective of the number of times the statement is executed, the database only ever gets one version of it, but with different parameters. So there's only one parse (which is both faster and more memory efficient for the server).

      I think the poster wanted to stress the fact that placehodlers automagically quote the value. If you don't use them (which sounds perfectly fine to me in the conditions you mentioned) you should at least use the quote() method to prevent havoc when an interpolated value contains potentially dangerous characters such as single quotes.

      -- TMTOWTDI

Re: Re: Re: Re: using sequences with dbi
by runrig (Abbot) on Oct 04, 2001 at 01:14 UTC
    Whether or not its 'complicated', if you're executing the same statement many times, its more efficient to use placeholders, especially on a database like Oracle, which keeps a SQL cache of its own, so you would benefit even when you only execute the statement a few times, but execute the script many times.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://116569]
[choroba]: Corion A colleague has helped me. It seems the "Modification of read-only value" was caused by old Test::More version which doesn't have done_testing, plus the old bug with $@ sometimes showing a different exception
[choroba]: will upload a fixed version and see
[Corion]: choroba: Ah, OK - sounds like a really weird combination :)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-06-25 14:14 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.