Solved

bind variables in php/mysql

Posted on 2004-03-22
4
758 Views
Last Modified: 2008-02-01
Oracle has bind variables. Bind variables are used to avoid re-parsing requests. For example, if I say

"select * from someTable where number < 100"
and then
"select * from someTable where number < 5000"

the second query requires a complete reparse even though it is very nearly parsed 1 second ago. if 100 and 5000 could be handled by a variable of some type, the parsing could be skipped.

So does mysql have bind variables and can you use them with mysql.
0
Comment
Question by:rfr1tz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:waygood
ID: 10652872
I havent come across that one yet I cant really see the need. If your going to process a query and then extend the query. Then theres going to be some overhead in doing this as you need to keep the previous query results.

Just a simple "WHERE number BETWEEN 100 AND 5000" would extend the query.
Or just "WHERE number < 5000 ORDER BY number" and process up to the point where number exceeds 100, and if necessary continue later.

I cant see any practical application of this, can you suggest one?

0
 
LVL 3

Author Comment

by:rfr1tz
ID: 10653304
We had an Oracle consutant in here and he said we should use bind variables to increase performance by avoiding re-parsing. That's pretty much all I know about it.

The consultant was very smart though. I think he was probably correct.
0
 
LVL 9

Accepted Solution

by:
waygood earned 250 total points
ID: 10653355
How big is your database then?

Did you know that Oracle is the most expensive piece of software in the world (as of about a year ago)
How much is Mysql? FREEEEEE!!! for non-commecial use

and for what, shaving a few milliseconds off your queries?
0
 
LVL 3

Author Comment

by:rfr1tz
ID: 10668236
Obviously, cost is why I want to use mySql whenever I can. mySql is constantly improving and hopefully it will soon be as good as Oracle.

Like many other software tools, Oracle has become so complex that you need consultants to come in and audit your installation. I doubt that many people have even heard of "bind" variables much less use them.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question