[odb-users] c++17,20,23 and sqlite
finjulhich at gmail.com
Sat Jan 29 14:10:01 EST 2022
On Mon, 24 Jan 2022 at 13:11, Boris Kolpackov <boris at codesynthesis.com>
> 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
> > the content of the file.
> > First, I'm not sure what C++ type to use for that file. I need to store
> > 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:
> 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.
Without a self-contained case, perhaps a specialisation is not found.
.cxx:1408:40: error: no matching function for call to
bool&, const std::vector<std::byte>&)’
1406 | sqlite::value_traits<
1407 | ::std::vector< ::std::byte >,
1408 | sqlite::id_blob >::set_image (
1409 | i.data_value,
1410 | i.data_size,
1411 | is_null,
1412 | v);
with std::vector<char> it worked on the other hand.
(GCC) 11.2.1 20211203
More information about the odb-users