2012-09-28 92 views
1

新手來sqlite3。sqlite3_open如何確定文件數據庫是否新鮮創建?

糾正我,如果我的理解是錯誤的?

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(...) 如果(第一次創建數據庫){創建表}

一種可能性是,以檢查文件的存在,但我不想這樣做。從sqlite3本身的任何替代方式?

回答

0

如果不存在該語法的語法,則可以使用create table。

Sqlite Create Table

+0

啊。簡單,有道理Thx。 – Whoami

相關問題