DBIx::Placeholder::Named and DBIx::Dictionary

izut on 2008-01-14T00:14:52

I updated last week DBIx::Placeholder::Named to version 0.07, which is more compliant with DBI - accepting PlaceholderSuffix and PlaceholderPrefix keys - after I presented it on Amsterdam.pm meeting. I can say that I was surprised that nobody yelled with some module doing the exact same thing...

And continuing the things-I-would-like-to-see-on-DBI I wrote DBIx::Dictionary, which tries to add, in the same clean way DBIx::Placeholder::Named does with named placeholders, query dictionary functionality.

It integrates well with DBIx::Placeholder::Named, and currently only supports Config::General configuration files. I'm planning to add support for some SQL compliant configuration file.

I'd like to hear from you what you think about those modules!


That looks useful...

btilly on 2008-01-14T22:33:19

But I won't be using it because named placeholders like that is already built in to DBD::Pg.

However if I was trying to write portable code that needed to handle lots of SQL, I definitely would use that.

Re:That looks useful...

izut on 2008-01-15T06:34:34

Hi btilly!

Actually, the DBIx::Placeholder::Named module was conceived in part of rewriting some functionalities of Tao::DBI, for example inheriting properly DBI, and one of its goals is provide named placeholders to database drivers that doesn't support it (like MySQL and SQLite, for instance).

The cool part about this project is if you want (or need) to deploy your application in some database other than postgresql, you can possibly do that without much effort.

Using DBIx::Dictionary as top layer for DBIx and DBIx::Named::Placeholder as its parent class, makes things a lot easier, making possible to rewrite your queries from PostgreSQL to $database and maintaining the same API.

Ah, and thanks for your response :-)

Phrasebooks

ferreira on 2008-01-15T11:26:17

With respect to DBIx::Dictionary, the concept of phrasebooks as introduced by this article: The Phrasebook Design Pattern, the Class::Phrasebook, and the newer (and more actively maintained) Data::Phrasebook can be a wealthy source of layout for the set of named queries.

Re:Phrasebooks

izut on 2008-01-15T13:14:24

The point in DBIx::Dictionary is have a real DBI subclass that support the phrasebook design pattern, and make it can even be subclassed by other DBIx::* classes like DBIx::Simple.

I wanted to write it with the same thinking I had in mind when wrote DBIx::Placeholder::Named, which was inspired by yours Tao::DBI: small and straight to the point.

Hope this clarifies the idea behind those modules :-)