<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I need to create the following query using DBIx:Class (assume I'm using the most recent release of DBIx::Class)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">select * from user_read_log where datetime between to_date(20090101, 'YYYYMMDD') and to_date(20091001, 'YYYYMMDD')&nbsp;</span></font></div><div><br></div><div>I've read the section of SQL::Abstract dealing with arrayrefs and scalarrefs and I am clearly not getting it. I've screwed around with a bunch of different syntaxes and am missing the mark.</div><div>This is just one of my attempts to make this thing fly:</div><div><br></div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>$rs = $c-&gt;model('DB::User_Read_Log')-&gt;search(</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; datetime =&gt;{"between", \["to_date(?, 'YYYYMMDD HH24:MM:SS')" =&gt;$start. "&nbsp;00:00:00",&nbsp;</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "to_date(?, 'YYYYMMDD HH24:MM:SS')" =&gt; $end. " 23:59:59"]</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);&nbsp;</span></font></div><div>&nbsp;&nbsp; &nbsp;</div><div><br></div><div>This particular version returns the error</div><div><br></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-tab-span" style="white-space:pre">        </span>ERROR: DBIx::Class::ResultSet::all(): DBIx::Class::ResultSet::all(): [SQL::Abstract::_where_field_BETWEEN]&nbsp;</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-tab-span" style="white-space:pre">        </span>Fatal: special op 'between' requires an arrayref of two values (or a scalarref or arrayrefref for literal SQL) at /home/khoofnag/svn/RCN-TEADWeb/script/../lib/RCN/TEADWeb/Controller/WorkOrder.pm line 93&nbsp;</span></font></div><div><br></div><div><br></div><div>Suggestions both for solving the problem at hand and for reading to really understand how to use functions in a where clause when coming from DBIx:Class. (Yes, I read the SQL::Abstract cpan page and it doesn't really serve someone dropping in conceptually from DBIx::Class. I'm looking for other discussions.)</div><div>Once I properly understand this stuff, I will see what I can do to add this example to the DBIx:Class cookbook &nbsp;and if I can find a way as a n00b to decently articulate what I've not been getting up to now, I'll see about blogging that in as well since it seems fundamental to getting along effectively with the package.</div><div><br></div><div>Thanks,</div><div>Karen</div></div></body></html>