[Pdx-pm] (OT) SQL style question

Kevin Long kevin.long at iovation.com
Thu Jan 13 16:12:29 PST 2005


I have use _DOT_ in the past. I would also consider other human readable
alternatives like _CONTAINS_ which conveys more meaning and avoids the
difficulty of seeing a difference between A_VERY_LONG__THING and
A_VERY_LONG_THING

Kevin Ernest Long | Creator of Cool
Office:  +1 503 224 6010 x 248 |  Fax:   +1 503 224 1581  |  Home Office
& Mobile:  +1 503 888 6879
-----Original Message-----
From: pdx-pm-list-bounces at pm.org [mailto:pdx-pm-list-bounces at pm.org] On
Behalf Of Austin Schutz
Sent: Thursday, January 13, 2005 3:33 PM
To: Randall Lucas
Cc: pdx-pm-list at pm.org
Subject: Re: [Pdx-pm] (OT) SQL style question

On Thu, Jan 13, 2005 at 03:19:53PM -0800, Randall Lucas wrote:
> > Quoting column names and using periods as separators:
> 
> I recommend against this, even if all your target database platforms 
> support escaped identifier names with periods in them.  For one thing,

> Class::DBI (and/or at least some of its related modules) doesn't play 
> nice with quoted names.  I got a good ways into an implementation that

> worked with all of my own software, using odd but escaped names on 
> Postgres, but found myself in a world of hurt when trying to use a 
> number of automation tools for SQL.
> 
> If you have the luxury, ban leading, trailing, and double underscores
in 
> all db identifiers except for the prefixed names.  That should
preserve 
> uniqueness of __ so that you can do a s/__/\./g to change names back.
> 

	This is pretty unrelated, but it reminded me of something truly
obvious I "discovered" recently.
	Perl let's you use qq{}; as a double quoting mechanism. That's
really handy for code like:

  $statement = qq{
    SELECT $table."bar.baz" FROM $table where "bar.baz" LIKE 'STUFF%'
  };

	where you have both single and double quotes in the mix. Also
makes it easy to maintain indentation without too much ugliness, as
opposed
to constructs like

  $statement = <<'  EOF'
    SELECT ...
  EOF
  ;


	One of those features in perl that I always knew about but never
considered using until fairly recently. Well, I did say it was obvious.
:-)

	Austin
_______________________________________________
Pdx-pm-list mailing list
Pdx-pm-list at pm.org
http://mail.pm.org/mailman/listinfo/pdx-pm-list
  

The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this email message in error, please notify the sender by reply email and delete the message and any attachments.


More information about the Pdx-pm-list mailing list