At 5:53p -0400 on 11 Jun 2007, Gordan Bobic wrote:
I don't understand this never-ending fascination with re-inventing a square wheel for an application for which the standard round type has already been kindly provided since year dot.

I imagine the reason for this "never-ending fascination ..." is along the lines of education. To the uninitiated, the idea of binding variables seems weird and unintuitive. "What?! I don't want them to be bound! They're variables! They're supposed to change." Okay, so it's a slight exaggeration, but I think the point is still good. A lot of folks pick up MySQL by fiddling around in their spare time. Unless someone (among my friends, it's usually me) enlightens them to better ways of doing things, and reasons for doing something in a more abstract, not-always-immediately-intuitive way, folks just don't know any better. In that sense, this very discussion is /exactly/ what the magazine article should be creating.

For those who don't know, binding is a process that does two things:

1. Lets the database pre-parse a query

This can give enormous boosts in speed because a large amount of the time involved in getting information from the database is spent in parsing and planning a query. If you're planning to do the same query many times over with only one or two different parameters, why not only parse and plan it once, and then aggregate the cost over / all/ the executions?

2. as well as let the database do any escaping necessary.

The database designers ostensibly know best what characters need to be escaped, so let them do it. Besides, no sense in having multiple definitions around, or reinventing a wheel, or wasting your time doing something mundane.

In lieu of an example, I'll just point to the PHP site:

http://us.php.net/manual/en/function.mysqli-prepare.php

Kevin

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to