Re: Standard DBI Proposal
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 11:43:51 +0100
Sean Woods wrote:
So at the risk of another long post, here's a quick draft of the "Sql[...]
dialect" functions I've developed for my own systems:
sqlprep value -[...]
Escape and quote a value in the manner the database engine
likes best. (i.e. foo -> 'foo')
sqlfix data -
Escape a string the way the database engine expects
Hold it right there, buster! I see PHP-style magic quoting! No! It's so
thoroughly misunderstood that it can only be viewed as an invitation to
SQL-injection attacks. (See http://xkcd.com/327/ for why this matters.)
My proposal was simpler in many ways, in that it *requires* that people
support (at the user Tcl script level if nowhere else) SQL prepared
statements with embedded references to Tcl variables. Internally, if the
DB engine is so broken that it doesn't do prepared statements, then the
DBI has to do the magic quotes stuff. But it hides what it is doing from
the script level.
I want to make databases easy to use. If that means it's a bit harder to
write the interface, so be it.
Donal.
.
- Follow-Ups:
- Re: Standard DBI Proposal
- From: Darren New
- Re: Standard DBI Proposal
- From: Gerald W. Lester
- Re: Standard DBI Proposal
- References:
- Standard Database Interface?
- From: tcltkdev
- Re: Standard Database Interface?
- From: Sean Woods
- Re: Standard Database Interface?
- From: tcltkdev
- Re: Standard Database Interface?
- From: Sean Woods
- Re: Standard Database Interface?
- From: thelfter@xxxxxxxxx
- Re: Standard Database Interface?
- From: Sean Woods
- Standard DBI Proposal (was: Re: Standard Database Interface?)
- From: Donal K. Fellows
- Re: Standard DBI Proposal (was: Re: Standard Database Interface?)
- From: Sean Woods
- Standard Database Interface?
- Prev by Date: Re: Converting Active Directory attribute lastLogonTimestamp
- Next by Date: Re: How to spawn ssh in new Window?
- Previous by thread: Re: Standard DBI Proposal
- Next by thread: Re: Standard DBI Proposal
- Index(es):
Relevant Pages
|