[odb-users] c++17,20,23 and sqlite

Boris Kolpackov boris at codesynthesis.com
Mon Jan 24 08:11:26 EST 2022


MM <finjulhich at gmail.com> writes:

> Hello,
> I need to hold the content of a custom layout file in a cell, about 30
> kbytes.
> I have a 1-row table where I store static data. 1 of the columns would hold
> the content of the file.
> 
> First, I'm not sure what C++ type to use for that file. I need to store the
> content, not the file path.
> The first thing that springs to mind is that I like the std::byte type.
> Would a std::basic_string<std::byte> work? Or a std::vector<std::byte>?
> What type would have a natural mapping in sqlite?

You can read more about the supported C++ to SQLite type mapping
in Section 18.1, "SQLite Type Mapping" of the ODB manual:

https://codesynthesis.com/products/odb/doc/manual.xhtml#18.1

Specifically, Section 18.1.2, "Binary Type Mapping" talks about
storing BLOB (binary large object). std::byte is most likely a
cute alias for char or unsigned char so std::vectro<std::byte>
will probably work out of the box.



More information about the odb-users mailing list