in reply to DBI not letting bind varibles in if you use a varible for the statement.
UPDATE: oops, ignore my first sentance. Just to save my butt for giving a bad answer, I will say that the second example (using a ? in the SQL statement and then passing arguments to the execute funtion) is better than using double quotes and interpolated any arguments in the SQL statement. The reason is because using the ? in single quotes will allow the SQL statement to be cached once, resulting in a slight performance increase. Example:
Just in case someone reading this didn't know . . .'SELECT * FROM FOO WHERE BAR=?' #this gets used many times #whereas "SELECT * FROM FOO WHERE BAR=$val" #might only get used once #because different values #of $val will cause many #different versions to get #cached
|
|---|