On Tue, 27 Mar 2007, Bernhard Graf wrote:

On Monday 26 March 2007 22:56, Goetz Bock wrote:

I would like to write an DBIx::Class tool for the sqlite3 database
generated by ulogd-sqlite3.

The basic setup is very simple, but there are some stumbling blocks:
- IPs are stored as integer (should have been unsigned int, but my
  sqlite returns signed (negative) integers ).
- time is stored as an integer, too.

I thought I could handle the IPs with an in-/de-flator:

__PACKAGE__->inflate_column( 'ip_daddr' => {
    inflate => sub { inet_ntoa( pack( 'N', shift ) ) },
    deflate => sub { unpack( 'N', inet_aton( shift ) ) },
});

Inflators work with objects only.

With references only (that arent scalar refs). There is a component in the works to allow if for everything. iirc it's ::Filter..

I've not even tried with the timestamp (oob_time_sec) and would
ultimately like to do queries like:

    ->search( { ip_daddr => "80.254.137.0/24" } );

Deflators aren't currently used when you do a search, so that won't work regardless.. It'd be nice though, want to patch it?

Jess


_______________________________________________
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/[email protected]/

Reply via email to