Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
select event.sid, event.cid, event.timestamp, signature.sig_name, iphdr.ip_ +src, iphdr.ip_dst, icmphdr.icmp_type, icmphdr.icmp_code, icmphdr.icmp_csum, icmphdr.icm +p_id, icmphdr.icmp_seq, udphdr.udp_sport, udphdr.udp_dport, udphdr.udp_len, udphdr.udp_csum, tcphdr.tcp_sport, tcphdr.tcp_dport, tcphdr.tcp_seq, tcphdr.tcp_ack, +tcphdr.tcp_off, tcphdr.tcp_res, tcphdr.tcp_flags, tcphdr.tcp_win, tcphdr.tcp_csum, t +cphdr.tcp_urp, sensor.hostname, sensor.interface, data.data_payload from event where event.sid = 1 left join signature on signature.sig_id = event.signature left join iphdr on iphdr.sid = event.sid and iphdr.cid = event.cid left join icmphdr on icmphdr.sid = event.sid and icmphdr.cid = event +.cid left join udphdr on udphdr.sid = event.sid and udphdr.cid = event.ci +d left join tcphdr on tcphdr.sid = event.sid and tcphdr.cid = event.ci +d left join sensor on sensor.sid = event.sid left join data on data.sid = event.sid and data.cid = event.cid order by timestamp desc, event.sid desc, event.cid desc
the WHERE part come from a form and can have numerous options set by the user. I used to do this with straight DBI + regex +placeholders and it was a pain in the ass to manage. Now i would like to do it in Class::DBI instead. I came across the following recipe on the CDBI wiki: http://wiki.class-dbi.com/index.cgi?UsingJoins http://wiki.class-dbi.com/index.cgi?DirectlyExecuteSql I undertand i can do this with SQL::Abstract (SQL::Abstract::Limit in my particular case since i need paging). Anyone can give me some tips, advices, best practices ? I am also wondering how can i integrate Data::Page to work with this query ? Is that possible ? Thanks a lot ! PS: Pardon for my not-so-perfect english
Edit: g0n - added code tags, linkified links
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class::DBI and Query with JOIN'S + Paging support
by pajout (Curate) on Oct 04, 2005 at 17:26 UTC | |
|
Re: Class::DBI and Query with JOIN'S + Paging support
by snoopy (Curate) on Oct 05, 2005 at 02:15 UTC |