Robotics StackExchange | Archived questions

Load binary data into a PostgreSQL database through the database_interface

Hello,

The databaseinterface package appears to provide serialization for storing data in the database as a byte array. The advanced concepts tutorial shows an example of how to read from the binary data, but not how to write to the database. Let's say I want to store a sensormsgs::PointCloud2 or a pcl::Pointcloud to the database. How would I read/write it?

I currently have a database set up in postgres that's ready to accept the binary info as bytea data. In the database interface classes, I have:

databaseinterface::DBField< std::vector< char > > viewpoint1_;

and in the constructor I have:

viewpoint1(databaseinterface::DBFieldBase::BINARY, this, "viewpoint1", "viewpoint", true)

I think this is set up properly, but I don't know how to get the data in and out of the database. Can anyone point me in the right direction?

Asked by flyingRobot78 on 2012-06-20 08:37:26 UTC

Comments

Answers