Random Thoughts from Castaway

22 Jul

Fairies and Aspect, an update

written by Castaway

I've been playing quite a bit of Might and Magic VII lately, the brain just didn't want to code, and its waaaaay too hot here..

But I did get some "work" done, mostly inspired by the people on #dbix-class who want to do funky deployment things with
SQL::Translator. I added a patch from omega to conditionally use quotes around table names in the PostgreSQL producer, as quoted ones are a pain in Pg. Hanging out on #dbix-class and helping people is a decent way to get known and get ideas..

So deploy in DBIx::Class takes the all in one output of an SQL::Translator producer, and proceeds to split it naively on ";\n" to get the individual statements. This makes a bit of a mess when the output contains comments, as the don't end in semi-colons.. and the next thing it does
is throw away lines beginning with "--" (an SQL comment). So when you have:

-- this is a drop statement
DROP TABLE mytable;

.. You get the idea. Anyway, SQL::Translator creates the output in the
first place by creating the individual statements, and gluing them
together with a join. So why not make it return the list of statements
in list context? So I did, and it's working for DB2, MySQL, and PostgreSQL so far. I also split the huge "produce" subroutine into
parts that create tables, fields, constraints and so on, for when you
only want bits.. And while I was at it, I added some "alter_" subs, which can now hopefully be used by SQL::Translator::Diff, which will be fun to fix..

None of this happened alone though, thanks to the folks on #dbix-class who tested, and prodded etc.

As for Aspect, after seeing a talk on it at Milton Keynes Perlmongers by Tom Hukins I eventually decided to use it yesterday at work, and it's great fun! Basically trying to figure out what data a system
uses, without actually altering it's code.

Your captcha is:

Only the comment itself is required, but if you supply your email we'll gladly load your gravatar. We won't use your email for any other purpose or sell it to nigerian business men. Promise.
A live preview of your comment will appear in this box.