[Dbix-class] complex db function

Oleg Pronin syber.rus at gmail.com
Mon Mar 19 15:05:33 GMT 2007


First method is to pass a scalar ref as one column (it will fall directly in
SQL).

$rs->search(undef,{
select=3D>['id', \'round((julianday(date2) - julianday(date1))*86400)'}],
as =3D> [('id',lastdate')],
});


2007/3/19, rahed <raherh at gmail.com>:
>
> Hi,
>
> I'd like to use a database function from SQLite which should produce
> this select:
>
> select id,round((julianday(date2) - julianday(date1))*86400) as 'tdiff'
> from mytable;
>
> I know I can search the resultset and specify the source for my column
> value as a function but don't know how to use the above more complex
> query with several functions.
>
> e.g. $rs->search(undef,{
> select=3D>['id',{somefunction=3D>'date2'}],
> as =3D> [('id',lastdate')],
> });
>
> Any suggestions?
>
> Thank you.
>
> --
> Radek
>
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
> http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070319/500=
5d76b/attachment.htm


More information about the Dbix-class mailing list