[Dbix-class] Using DBIx::Class with PostGIS geometry columns
Robert Rothenberg
robrwo at gmail.com
Thu Jan 3 16:25:31 GMT 2013
I'm looking for a less painful way of using DBIx::Class with a database that
has PostGIS geometry columns.
Ideally, I'd like to use InflateColumn to automatically inflate/deflate
geometry columns using the ST_AsEWKT and ST_GeomFromEWKT functions, but I am
unsure how to do this, or even if it's possible.
Using something like
__PACKAGE__->inflate_column( 'geo', {
inflate => sub {
my ($raw_value, $result) = @_;
my $col = $result->get_column("geo")->func("ST_AsEWKT");
},
});
doesn't work, because $result->get_column() is returning the scalar value of
the column instead of a ResultSetColumn object, which is annoying (and a bit
confusing, since I've looked at the source for ResultSet and cannot
understand why it's doing that).
Assuming I am able to get this to work in a similar manner, I'm still unsure
how to implement deflate.
Any pointers would be helpful.
More information about the DBIx-Class
mailing list