[Oc-pm] June 20th Meeting Notes

Douglas Wilson dgwilson1 at cox.net
Fri Jun 29 19:37:49 PDT 2007



Ben Tilly wrote:
> On 6/28/07, Douglas Wilson <dgwilson1 at cox.net> wrote:
> 
> It truly puzzles me that experienced programmers who would never think
> of not indenting code, frequently don't indent SQL.  SQL is code like
> anything else.  All of the reasons to indent anything, apply to SQL.

Old habits, and all that...not that I'm not open to change.

> 
>> When embedding SQL into indented blocks, I tend to use
>> the style at the bottom of this post:
>> http://www.perlmonks.org/?node_id=615032
> 
> Did you notice that you have syntax errors there?

Uh, yeah...I thought I fixed that...I copied actual code, then
quickly removed any meaningful names, and pasted into the
web form...anyway, at least one syntax error is fixed now :-)

Someday I may post the real actual code, it'd probably help
users of Informatica, but I'm not sure of the license
restrictions, as they have never been keen to give out
explanations of their database schema (probably due to
how horrible it is). There might be restrictions
on publishing anything about it.

> 
> You can comment out individual lines of SQL with --.  Or blocks with
> traditional C-style comments like /* ... */.  (I almost always use the
> former style.)

It's not commenting out single lines or blocks that's the problem..it's
commenting out the specific SELECT columns for some tables, then
commenting out the specific tables in the FROM clause, then the
specific joins and filters in the WHERE clause. Though I can think
of other ways of handling that...

And it's just as bad or worse if there's a giant nested foreach loop
of SQL executing and fetching.

> 
>> The biggest drawback with the framework in that thread is that you
>> can't order by arbitrary columns :-(

> 
> Native SQL avoids that drawback as well. :-P
> 
> But it seems to me like it should be easy to add that back in?

It's on the TODO list :-)

 > I look forward to seeing you again.

Same here.



More information about the Oc-pm mailing list