sqlite3如何判断一个表是否已经存在于数据库中 C++

Posted shfanzie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sqlite3如何判断一个表是否已经存在于数据库中 C++相关的知识,希望对你有一定的参考价值。

SELECT count(*) AS cnt FROM sqlite_master WHERE type=‘table‘ AND name=‘table_name‘;
cnt will return 0, if the table doesn‘t exist, 1 if it does.

或者,

SELECT name FROM sqlite_master WHERE type=‘table‘ AND name=‘{table_name}‘;
This will return empty, if the table doesn‘t exist, table_name if it does.

sqlite3如何判断一个表是否已经存在于数据库中c++

以上是关于sqlite3如何判断一个表是否已经存在于数据库中 C++的主要内容,如果未能解决你的问题,请参考以下文章