Re: [Maypole] Re: Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

From: Brian Glass (brian at glassbrian.com)
Date: Fri Dec 03 2004 - 12:46:27 GMT


Peter Speltz wrote:

>It, putting this in _to_select, is desireable but It is tricky because the text
>for the option is the stringify of the object so you need the object to get
>that EXCEPT if this is set via "columns(Stringify" I believe. So, it seems
>there has to be a little more communication between AsForm and the model class
>to let _to_select know do this the efficient way ONLY IF the stringify value is
>set via a sub. Does this sound about right?
>
>My idea is to make a sql_select_box_data via set_sql that would return id and
>columns you want in string to appear in the select box.
>
>Then
> if (@select_box_cols = $class->select_box_cols || $class->columns('Stringify')
>) {
> # Do it efficient way, no object creation
> my $sth = $class->sql_select_box_data;
> # Someone fill in here
>}
>
>else {
> # current inefficient way
>}
>
>
>
If sub stringify_self is defined then we CANNOT do this the efficient
way. stringify_self needs to be called for each row/object and will
probably proceed to go out and do more SQL queries. Only if the
stringifying is done via __PACKAGE__->columns( Stringify => /foobar/ )
should we do things the efficient way.

OTOH, I am using both methods in my class and the select boxes are
generated using Stringify and most other things via stringify_self.

If I'm not mistaken set_sql does object creation. I think this is what
we're trying to avoid in this case so it would probably be better to go
with straight DBI.

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT