Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Do you know where your variables are?
 
PerlMonks  

Re: SQL Injection myths under DBI

by dbwiz (Curate)
on Apr 12, 2005 at 03:32 UTC ( [id://446884]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to SQL Injection myths under DBI?

I second tilly's opinion that what you are saying is plainly wrong, and here are a few points that you shoudl consider:

  • my $sth = $dbh->prepare ("select username, password from users where sid='?';" )

    That is simply wrong.
    Placeholders must not be quoted. A placeholder means "leave it to the database driver to deal with any quoting business."

  • this solution will cost you a hell of a work if you like the simplicity of the do() method and have used it all over your code
    What's wrong with using the do() method with placeholders?
    $dbh->do("INSERT INTO table (id, name) values (?, ?)", undef, $id, $na +me);
  • But what I could conclude, after a lot of thinking and, most of all, after testing all the supposedly harmfull examples in my little script, is that the only problem is the single quote
    That depends on the database you are using, and you should not be concerned about this matter, if you care to use the $dbh->quote method, which you should go and read in the docs.

The bottom line: I am afraid you don't know what you are talking about. Please read the docs more carefully.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://446884]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.