On 6/2/06, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: > When I insert or update those columns I need RDBO to wrap the data I > provide in GeomFromText() ("insert into t (name, geo) values (?, > GeomFromText(?)"). > > How do I do that? > > (Likewise, on selects it's helpful if I can do something similar to > convert the column to something more easily readable than the binary > column data).
The answer to both questions is a custom column class for this kind of data, which leads to a custom method-maker, which may or may not call through to a new format_point() method in Rose::DB (depending on how db-independent you want to be). For the first part, wrapping values in GeomFromText() in INSERT, it's simply a matter of having your custom accessor method for this column type return the value wrapped in GeomFromText() when saving to the database. Public APIs exist for most of this, but require you to "inline" the entire column value instead of using GeomFromText(?) with a place-holder. And to do that, you need to ->meta->allow_inline_column_values(1). For the second part, getting custom SQL into the SELECT statement around a column, the API is still private. I've only used it once so far, in the Bitfield column type, and then only in MySQL under some conditions. Let me flesh out support for this type of thing and put it in the next release. In the meantime, look at the bitfield methods in Rose::DB::MySQL, the bitfield method-maker in Rose::DB::Object::MakeMethods::Generic, and the Rose::DB::Object::Metadata::Column::Bitfield column class to get an idea of the moving parts. You might be able to hack out something that works even without the better hooks I plan to add. -John _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object