<html><head><base href="x-msg://55/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 23, 2010, at 2:15 PM, David wrote:</div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hi,<br><br>I can't find how to set 'where' clause in an update. I only want to update rows depending on a condition. Is that possible?<span class="Apple-converted-space">&nbsp;</span><br>I haven't this option in ResultSet documentation.<br><br>I try like next, but it doesn't work. It updates all table rows.<br><br>$c-&gt;model('DB::Test')-&gt;update({'lang' =&gt; $lang-&gt;first-&gt;id},{where =&gt; {'id' =&gt; $c-&gt;user-&gt;get('id')}});</div></div></span></blockquote><br></div><div>This is really a DBIx::Class question and belongs on that list.</div><div><br></div><div>However.. you perform update on a resultset. $c-&gt;model() returns a resultset with no where clause. So get the resultset that you need with search and then call update() on that.</div><div><br></div><div>$c-&gt;model('DB::Test')-&gt;search({ 'id' =&gt; $c-&gt;user-&gt;get('id') })-&gt;update({'lang' =&gt; $lang-&gt;first-&gt;id});</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- john romkey</div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://www.romkey.com/">http://www.romkey.com/</a></div><div><br></div></body></html>