Sqlite:向表和列添加注释?

MysqL Workbench中,您可以向MysqL数据库中的表和列添加注释。

sqlite是否支持向表和列添加注释?

我不认为这样。 “SQL As Understood By SQLite”页不提及表格或列的注释,也不提供 CREATE TABLEALTER TABLE文档。

另外,Unsupported SQL维基页面有:

2009-08-04: Table and column comments – I have scoured the doco and can’t find anything about applying comments to tables or their columns.

是的,这是2009年的wiki页面,但其他文档支持该注释。

但是,sqlite会保留您在DDL中的sql注释。如果将其提供给sqlite3 CLI工具:

CREATE TABLE User
        -- A table comment
(
        uid INTEGER,-- A field comment
        flags INTEGER   -- Another field comment
);

然后你从.schema命令得到这些:

sqlite> .schema
CREATE TABLE User
        -- A table comment
(
        uid INTEGER,-- A field comment
        flags INTEGER   -- Another field comment
);

因此,如果您可以控制用于创建表的DDL,则应该可以伪造它。

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能