数据库
首页 > 数据库> > c – 将SQLite与WinRT一起使用

c – 将SQLite与WinRT一起使用

作者:互联网

我正在开发一个metro ui应用程序,我想将SQLite用于一些内部数据而不是JET,以便利用一些已编写的代码.

当我尝试使用sqlite3_open打开数据库时,它不起作用.我收到一条错误消息,指出无法打开数据库.

我相信SQLite使用的一些API不能用于metro风格的应用程序.

有人可以帮我吗?至少告诉我如何识别应移植的api?

解决方法:

这段代码应该有效:

auto localAppDataParh = Windows::Storage::ApplicationData::Current->LocalFolder->Path;
std::wstring path( localAppDataParh->Data() );
path += L"\\sample.db";
sqlite3* db;
int rc = sqlite3_open16( path.c_str(), &db);

I believe some APIs used by the SQLite cannot be used on metro style application.

可能会起作用(至少在预览版上),但不允许. Windows App Cert Kit说:

   Error: This application failed the supported API check.
   API CreateFileA in kernel32.dll is not supported for this application type. 
   API CreateFileW in kernel32.dll is not supported for this application type. 
   API DeleteFileA in kernel32.dll is not supported for this application type. 
    :
    :

标签:c,sqlite,porting,windows-runtime,microsoft-metro
来源: https://codeday.me/bug/20190826/1733132.html