I personally can't quite see why this is any better than SQL.

Call me crazy, but I rather like SQL - it's pretty clear given enough whitespace.
Aliases make selecting from multiple tables and/or subselects tidy too.

Vanilla SQL* is going to be more portable than DAL - learn SQL and you can use it from Perl, PHP, $fave_language, whereas DAL is only being to be useful with your module to hand.

You're not providing anything clever (i.e. database independent SQL).

It'd be really cool if DAL spat out SQL that attempted to do The Right Thing, depending on the database it's talking too.

Interesting idea, but I can't see any practical use for it.

Cheers.

BazB

* OK, I know that Oracle, MySQL, PostGreSQL etc all have their own specific SQL extensions/mutations.

Update:
When I use SQL, I tend to go totally overkill on the whitespace.
Taking your example SQL, I have to admit the way you've formatted it is pretty nasty.

I'd lay it out as follows:

SELECT w.id, w.definition FROM words w, stock s, languages l, stockmatch m, types t WHERE s.word = ? AND l.name = ? AND s.languageID = l.id AND m.stockID = s.id AND w.id = m.wordID AND t.name = ? AND w.typeID = t.id;

I'd possibly group the where clauses together by table too, if it made it easier to figure out which tables/columns where being used without having to scan up and down the list.

You'd line everything up in Perl, why not do it in SQL?


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.


In reply to Re: Module Design Review -- DB mini language by BazB
in thread Module Design Review -- DB mini language by elusion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.