Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Safety of concatenating query string

by {}think (Sexton)
on Jun 24, 2011 at 10:16 UTC ( [id://911221]=note: print w/replies, xml ) Need Help??


in reply to Safety of concatenating query string

One VERY MINOR point is that with the placeholder version, your database sees both sort-column statements as being the same statement (ending in ORDER by ?) as opposed to two statements with differing ORDER clauses. One single statement means one single prepare / execution plan, and thus saves time.
I must confess, I use BOTH techniques as I see convenient.
{}think; #Think outside of the brackets
  • Comment on Re: Safety of concatenating query string

Replies are listed 'Best First'.
Re^2: Safety of concatenating query string
by Jenda (Abbot) on Jun 25, 2011 at 22:07 UTC

    I wonder what database would allow "... ORDER BY ?", especially since different values for the order by clause would lead to (quite likely wildly) different execution plans.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Oracle allows it. Right or wrong, it works.
      {}think; #Think outside of the brackets

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found