sqlite3_open - 如果文件是一个sqlite3的数据库问题检查 [英] sqlite3_open - problems checking if a file is a sqlite3 database
本文介绍了sqlite3_open - 如果文件是一个sqlite3的数据库问题检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我与sqlite3的首次合作,并不能得到正常的检查文件它打开它。到目前为止,sqlite的总是上的任何文件返回OK。
此外,该文件名是从GTK的文件选择返回的变量。它返回一个绝对路径,我猜这是没有问题的。
感谢您的帮助。
这是code的一个片段:
INT RC;
字符*文件名;
sqlite3的*分贝;文件名= gtk_file_chooser_get_filename(等);如果(SQLITE_OK == RC = sqlite3_open(文件名,和放大器; DB))
{等}
解决方案
sqlite3_open
实际上并不读取文件,直到第一个非 - 编译
语句是prepared。
sqlite3_open_v2
提供其他的选择。
I'm working with sqlite3 for the first time, and cannot get it to properly check a file before it opens it. So far, sqlite always returns OK on any file.
Also, the file name is a variable returned from the GTK file chooser. It returns an absolute path, I'm guessing this is not a problem.
Thanks for any help.
This is a snippet of the code:
int rc;
char *filename;
sqlite3 *db;
filename = gtk_file_chooser_get_filename(etc.);
if(SQLITE_OK == rc = sqlite3_open(filename,&db))
{ etc. }
解决方案
sqlite3_open
doesn't actually read the file until the first non-pragma
statement is prepared.
sqlite3_open_v2
provides other options.
这篇关于sqlite3_open - 如果文件是一个sqlite3的数据库问题检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文