[Dbix-class] abstract syntax (extract from a conversation)
Brandon Black
blblack at gmail.com
Sat Jul 21 13:17:01 GMT 2007
On 7/20/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Those of you who do, please bear in mind when responding what anything
> involving the creation of assloads of objects will be laughed at and/or
> ignored since the intention is SQL::Abstract-level performance.
>
Along the lines of performance concerns, I suspect even with a focus
on speed that this two-pass AST system is going to slow us down a
little in return for the flexibility it adds. It might be important
to allow for values to specified as (possibly named, as opposed to the
ordering-sensitive ?'s common in SQL) placeholders in both the DWIM
and explicit AST, allowing the DWIM -> explicit -> SQL conversion to
be cached and re-used with different variables, like (and probably in
conjunction with) prepare_cached, but at a higher level.
Then it's just a matter of implementation details like having RS's
cache their converted explicit AST and SQL representations when
executed via some new syntax, like:
sub elsewhere {
$self->{complex_rs} = $some_rs->search({ ... complicated stuff for
the parser here, has bind vars });
}
sub called_many_times {
my $rs = $self->{complex_rs}->execute(foo => $_[0], bar => $_[1]);
while(my $row = $rs->next) { .... }
}
Of course this touches on that whole thing about splitting ResultSets
up into their two functional parts again too (rs as abstract query, rs
as sql cursor)...
-- Brandon
More information about the Dbix-class
mailing list