【问题标题】:sqlite3_open how to determine if file database created freshly?sqlite3_open 如何确定文件数据库是否是新创建的?
【发布时间】:2012-09-28 05:09:15
【问题描述】:

sqlite3 的新手。

如果我的理解有误,请纠正我?

sqlite3_open ( 文件名, &dbConnection) ->

1) This API creates an database [ie: filename], if it does not exists, and sets
the context to dbConnection. 
2) If the database exists already it just sets the context to dbConnection. 

情况 (1) 和 (2) 都返回 SQLITE_OK。

问题:如果数据库是第一次创建,现在是否有可能过滤?

例如: sqlite3_open (... ) if (第一次创建数据库) { create table }

一种可能性是检查文件是否存在,但我不想这样做。 sqlite3 本身有什么替代方法吗?。

【问题讨论】:

    标签: c sqlite


    【解决方案1】:

    如果不存在语法,你可以使用创建表。

    【讨论】:

    • 啊。简单,有道理,谢谢。
    猜你喜欢
    • 1970-01-01
    • 2016-07-12
    • 1970-01-01
    • 1970-01-01
    • 2010-12-19
    • 2011-08-03
    • 1970-01-01
    • 1970-01-01
    • 2012-08-28
    相关资源
    最近更新 更多