DBIx::Renderer - talk SQL by using Perl data structures |
DBIx::Renderer - talk SQL by using Perl data structures
use DBIx::Renderer ':all';
# mandatory name use constant TYPE_MANDNAME => ( VARCHAR(255), NOTNULL );
my $struct = [ category => [ id => { TYPE_ID }, name => { TYPE_MANDNAME }, parent_id => { INT4, INDEX }, ], ];
my $renderer = DBIx::Renderer::get_renderer('Postgres'); print $renderer->create_schema($struct);
I got fed up with having to write different variants of SQL for different database engines. Also, I was looking for a way to specify a schema in Perl. The idea is that you construct data structures which are then rendered into the type of SQL appropriate for the target database server. Along the way we can make some optimizations and customizations, such as using database-specific features. For exmaple, we might make use of Postgres' array data types, but render them into weak relations for other servers.
Also, outputting the schema in XML might be useful.
DBIx::Renderer::Constants
constants and functions,
see its manpage for details.
get_renderer($name)
new()
constructor on the package
DBIx::Renderer::$name
.
Class::DBI
.
None known so far. If you find any bugs or oddities, please do inform the author.
Marcel Grünauer <marcel@codewerk.com>
Copyright 2001 Marcel Grünauer. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), DBI(3pm).
DBIx::Renderer - talk SQL by using Perl data structures |