How do I, reliably , check in SQLite, whether a particular user table exists?
(我如何可靠地在SQLite中检查特定的用户表是否存在?)
I am not asking for unreliable ways like checking if a "select *" on the table returned an error or not (is this even a good idea?).
(我不是在要求不可靠的方法,例如检查表上的“ select *”是否返回错误(这甚至是个好主意吗?)。)
The reason is like this:
(原因是这样的:)
In my program, I need to create and then populate some tables if they do not exist already.
(在我的程序中,我需要创建然后填充一些表(如果它们尚不存在)。)
If they do already exist, I need to update some tables.
(如果它们已经存在,则需要更新一些表。)
Should I take some other path instead to signal that the tables in question have already been created - say for example, by creating/putting/setting a certain flag in my program initialization/settings file on disk or something?
(我是否应该采取其他路径来表示已创建相关表,例如,通过在磁盘上的程序初始化/设置文件中创建/放置/设置某个标志,或其他方式来表示此表?)
Or does my approach make sense?
(还是我的方法有意义?)
ask by PoorLuzer translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…