5 oct 2009

SQL::Template 0.1.0 released

Imagine this situation: you know DBI and you like it, because you can make use of your SQL knowledge. But you are not happy having the SQL code into the Perl code. You can use other CPAN modules, which let us to abstract SQL code. But we want to write SQL code, we feel confortable with it.

The SQL::Template module manages this ideas:

  • decoupling SQL sentences from Perl code, writting sentences in a XML file, that you can use in different parts of your code.
  • Dynamic test of expressions.
  • Reuse of SQL fragments.
  • Simple API (very close to DBI).

I invite you to see and use this module (it's production ready). Comments are welcome.


3 comentarios:

  1. Hi,

    Google for DBIx::Class presentation - have a quick look at the beginner talk there. This is NOT the same as what you are doing, but you might find it interesting - especially the chained methods.

    I commend you on doing a cpan module, I just think XML is icky and DBIx::Class is quite established.

    Enjoy

    Leo

    ResponderEliminar
  2. I take it you didn't spot Data-Phrasebook [1] and its associated Data-Phrasebook-Loader-XML [2] distributions :)

    [1] http://search.cpan.org/dist/Data-Phrasebook
    [2] http://search.cpan.org/dist/Data-Phrasebook-Loader-XML

    ResponderEliminar
  3. You're rigth, I haven't used (nor shown) Data-Phrasebook module; but I thin'k SQL::Template includes dynamic clauses that Data-Phrasebook-SQL does not. For example:

    <st:select name="query_for_persons">
    SELECT * FROM PERSON
    <st:if test="${NAME}" prepend="WHERE">
    NAME=${NAME}
    </st:if>
    </st:select>

    ResponderEliminar