[Dbix-class] retrieve_from_sql

Matt S Trout dbix-class at trout.me.uk
Thu Aug 4 22:31:24 CEST 2005


On Thu, Aug 04, 2005 at 09:37:04PM +0200, Krzysztof Krzyzaniak wrote:
> select my_table_insert(field1, field2); (which means actually "insert 
> into my_table values (field1, field2); select currval("my_table_seq");")
> 
> Why I am asking? I am in the beginnig of quite complicated project which 
> uses postgresql and pl_perl. And I am thinking what I could gain by 

I'm currently working on factoring the internals out into nice,
well-defined layers (having realised that far too much stuff was lumped
together and that was a cdbi mistake I was re-making on everybody else's
behalf).

The eventual aim is that the Engine classes (of which Engine::DBI is the
first and will probably be the most commonly used, at least until we get
Engine::Rosetta) will generally deal with the specifics of sending queries;
I'm intending the interface to be a create/update/insert query runner plus
a select that returns a cursor (it's currently returning an sth, but that's
because it let me get part of the way there quickly).

I'd imagine the easiest way to achieve something like this would be to
provide a suitable DBIx::Class::Engine::DBI::MyCustomInsert that wraps
the ->insert method to do Something Different where necessary and then have
your engine class be

package My::DBIC::Engine;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/Engine::DBI::MyCustomInsert Engine::DBI/);

This is all a bit hand-wavy though; as I get the core cleaned up and
separated out things should become a little clearer.

-- 
     Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.



More information about the Dbix-class mailing list