[odb-users] Using --generate-schema does not output sql file when using sqlite

Boris Kolpackov boris at codesynthesis.com
Fri Jul 3 13:47:42 EDT 2015


Hi Teererai,

Teererai Marange <selection989 at gmail.com> writes:

> I am working with the hello world example given on the tutorial pages and
> am trying to work through all the steps. When I enter
> 
> odb -d sqlite --generate-query --generate-schema person.hxx
> 
> no sql file is generated and so I am not able to create a database
> schema on sqlite. How do I proceed in such a situation?

By adding the '--schema-format sql' option. Quoting from the ODB
command line manual (man page):

--generate-schema|-s
    ...

    Depending on the database being used (--database option), the schema is
    generated either as a standalone SQL file or embedded into the generated
    C++ code. By default the SQL file is generated for the MySQL, PostgreSQL,
    Oracle, and Microsoft SQL Server databases and the schema is embedded into
    the C++ code for the SQLite database. Use the --schema-format option to
    alter the default schema format.

    ...

The reason for generating embedded schema for SQLite is that it is
an embedded (as in-process) database and .sql file is seldom used.

Boris



More information about the odb-users mailing list