ODB --generate-schema 选项未生成 sql 文件

度娘未见答案(什么时候开放google),自己查看帮助文档发现,在数据库类型为sqlite的情况下,SQL 文件是内嵌的,所有不会单独生成sql文件,需添加--schema-format 选项,设置sql来生成单独的sql文件,具体信息见odb命令参数说明:

--generate-schema|-s

Generate the database schema. The database schema contains SQL statements that create database tables necessary to store persistent classes defined in the file being compiled. Note that by applying this schema, all the existing information stored in such tables will be lost.

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.

If database schema evolution support is enabled (that is, the object model version is specified), then this option also triggers the generation of database schema migration statements, again either as standalong SQL files or embedded into the generated C++ code. You can suppress the generation of schema migration statements by specifying the --suppress-migration option.

 

--schema-format format

Generate the database schema in the specified format. Pass sql as format to generate the database schema as a standalone SQL file or pass embedded to embed the schema into the generated C++ code. The separate value is similar to embedded except the schema creation code is generated into a separate C++ file (name-schema.cxx by default). This value is primarily useful if you want to place the schema creation functionality into a separate program or library. Repeat this option to generate the same database schema in multiple formats.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值