[odb-users] Streaming BLOBs

Boris Kolpackov boris at codesynthesis.com
Thu Jun 7 09:00:58 EDT 2012


Hi Philippe,

Philippe Cadieux-Pelletier <philly.dilly at gmail.com> writes:

> Are there any plans to add support to stream blobs, let's say by binding
> std::istream to blobs?

If this is for a member of a persistent class, then you would need a
bi-directional stream (i.e., std::iostream), since it will have to
support both reading (for persist, update, etc.) and writing (for
load, query, etc).

There are only two cases where you may want to use a unidirectional
stream: in query parameters (std::istream) and in views (std::ostream).

However, I am still having a hard time coming up with a realistic use
case for this. Can you provide a bit more details on what you are trying
to achieve?

Also note that currently ODB doesn't use the SQLite BLOB streaming
mechanism (i.e., sqlite3_blob_open() & friends[1]) for BLOB reading/
writing. We may support this in the future (as we do for some other
databases, e.g., Oracle and MS SQL), though there are some tricky
limitations of this mechanism in SQLite that we still need to think
about.

[1] http://www.sqlite.org/c3ref/blob_open.html

Boris



More information about the odb-users mailing list