<br><tt><font size=2>Bill Moseley &lt;moseley@hank.org&gt; wrote on 06/20/2012
02:00:57 PM:<br>
<br>
&gt; From:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Bill Moseley &lt;moseley@hank.org&gt;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; To:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; &quot;DBIx::Class user and developer list&quot; &lt;dbix-class@lists.scsys.co.uk&gt;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Date:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; 06/20/2012 02:05 PM</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Subject:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Re: [Dbix-class] Search_rs not returning newly created rows</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; On Wed, Jun 20, 2012 at 1:49 PM, Len Jaffe &lt;lenjaffe@jaffesystems.com&gt;
wrote:</font></tt>
<br><tt><font size=2>&gt; <br>
</font></tt>
<br><tt><font size=2>&gt; On Wed, Jun 20, 2012 at 2:39 PM, Bill Moseley
&lt;moseley@hank.org&gt; wrote:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; I'd worry less about where your database calls are happening. &nbsp;Do
<br>
&gt; you really care if [% user.address.city | html %] hits the database
<br>
&gt; in the template or in the controller? &nbsp;</font></tt>
<br><tt><font size=2>&gt; Well, not caring where this happens tends to
lead to the what you <br>
&gt; describe next. &nbsp;Why not put the address data in the stash? The
model<br>
&gt; knows it will need to display it.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; A bit off the topic here. &nbsp;There's no perfect solution. &nbsp;I've
<br>
&gt; unwound loops in Controllers, too.&nbsp;</font></tt>
<br><tt><font size=2>&gt; &nbsp;</font></tt>
<br><tt><font size=2>&gt; &nbsp;</font></tt>
<br><tt><font size=2>&gt; One point of the object abstraction is you don't
care about the <br>
&gt; implementation. &nbsp; The real problem I've seen, though, is doing
<br>
&gt; something stupid like huge nested loops in the template where each
<br>
&gt; one generates a query.</font></tt>
<br><tt><font size=2>&gt; This is what I meant to about maintenance nightmare.&nbsp;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; I've inherited apps like this where I had to roll nested queries (in<br>
&gt; templates) up into a single query to go from 120 round-trips to the
<br>
&gt; database, taking 8 seconds, into one round trip, taking half a second.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; L.</font></tt>
<br><tt><font size=2>I solved the original problem by eliminating the prefetch
call that was creating an incorrect join and limiting the resultset. The
page that lists the accounts is one of my most expensive db calls, and
it takes about a third of a second to return data over a long distance
remote connection, so it's not much of an issue. I have a few fields where
they did some fun stuff with case statements and assigning a text string
based on the status/contenys of several different fields. I could not figure
a way to duplicate that without raw sql, so I built it into the template
code. That is truly an ugly way to do it. But, I had to balance that against
the business need. To spend the time to do it differently for the 4-6 users
that may hit the app a day didn't seem like a good investment of my time.
Once I have it up it is one of the things I will be revisiting.</font></tt>