[odb-users] dynamic multidatabase mysql

Wolfgang Haupt haupt.wolfgang at gmail.com
Thu Nov 10 16:11:40 EST 2016

Hi Boris,

thanks for your hint, schema-format embedded works for mysql, too.
Another quick question:
In case of sqlite if the database is not yet created odb will create it.
For mysql an empty database has to be there.
I use the ctor like this: m_db = std::shared_ptr<odb::core::database>( new
odb::mysql::database(settings.user, settings.pass, "common"));

Couldn't find an API doc for mysql:
Can I omit the db name and let the schema catalogue create the db instead
if it does not exist?

Thank you.

BR Wolfgang

Wolfgang Haupt <haupt.wolfgang at gmail.com> schrieb am Do., 10. Nov. 2016 um
10:50 Uhr:

> Ah I read about this in the postgresql docs.
> Will try to add it, thank you.
> BR Wolfgang
> Boris Kolpackov <boris at codesynthesis.com> schrieb am Do., 10. Nov. 2016
> um 09:52 Uhr:
> Hi Wolfgang,
> Wolfgang Haupt <haupt.wolfgang at gmail.com> writes:
> > I know my question is rather vogue, but I'm experimenting with sqlite and
> > mysql support and I can't get mysql to work.
> > It seems to connect to the db but fails immediately with:
> >
> > terminate called after throwing an instance of 'odb::unknown_schema'
> >   what():  unknown database schema ''
> If this works for SQLite but not for MySQL then it most likely due to
> missing "--schema-format embedded". For SQLite this is the default but
> for MySQL by default the database schema is generated as a standalone
> .sql file.
> Boris

More information about the odb-users mailing list