<br><br><div><span class="gmail_quote">On 10/3/06, <b class="gmail_sendername">Daniel McBrearty</b> <<a href="mailto:danielmcbrearty@gmail.com">danielmcbrearty@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
if you have a (dbix) database, and use it as a model, you generally<br>end up doing this :<br><br>$c->model-> ....<br><br>and the database connection is handled internally.<br><br>I now want to write another model which uses the db. It would be
<br>better to use the existing connection that cat has created, rather<br>than create another one.<br><br>If I write a new() method for this model, does it have access to the<br>context? what is a good way to do this?</blockquote>
<div><br>What kind of model is your new model, and how will it use/store/whatever the $dbh? There are a lot of ways to do what you're talking about in general, it all depends on what's right for your design. Be aware that once you take the raw $dbh from DBIC and start using it yourself, you lose all of its fancy connection management.
<br><br>-- Brandon<span style="font-weight: bold;"></span><br></div><br></div>