NYCPHP Meetup

NYPHP.org

[nycphp-talk] naming identifiers

Kristina D. H. Anderson ka at kacomputerconsulting.com
Mon Aug 31 08:22:30 EDT 2009


I was trained from the get-go back when I was using Access and SQL 
Server in the 90s to never, ever use reserved words for table or field 
names...and also to never use just "id" for the primary key field name.

I'm wondering why both phpMyAdmin and a number of the boilerplate PHP5 
frameworks' database code bases that I've seen all seem to be pushing 
the use of these delimiters around really, every single table and field 
name at all times, whether required or not.  I hadn't given it much 
thought until this thread but the amount of them that I've seen over 
the past year or so has skyrocketed.

In all honesty I didn't give much thought, either, to exactly why they 
were there and just removed them due to my longstanding habits in 
writing queries.

To my mind, for phpMyAdmin and code frameworks out there to be 
promoting what is, no matter how you frame it, nearly universally 
considered bad practice, by promiscuously using these delimiters 
everywhere is just scary.

Is there some push on the part of MySQL to require these delimiters as 
a matter of course in some future version, or...?

Kristina



> On Mon, Aug 31, 2009 at 12:28 AM, Daniel Convissor
> <danielc at analysisandsolutions.com> wrote:
> >
> > On Sun, Aug 30, 2009 at 10:37:33AM -0400, Andy Dirnberger wrote:
> > >
> > > If you are
> > > afraid that you might use a reserved keyword for a field name, 
use the
> > > ` delimiters around the name of the field in your queries.
> >
> > Which is exactly what started this subthread.  Delimiting 
identifiers is
> > a bad practice that creates way more headaches than it solves.  Of
> > course, feel free to stick to it.  I'll just pray I never get 
called in
> > to clean up your code.
> >
> > --Dan
> >
> 
> I'll pray that, too, because you'd be the first.
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/show_participation.php
> 
> 








More information about the talk mailing list