Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SQLite with WinRT

I am developing a metro ui application and I would like to use SQLite for some internal data instead of JET in order to take advantage of some already-written code.

Howerver when I try to use sqlite3_open for opening a data base, it does not work. I get an error saying a cannot open the data base.

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

Can someone help me on this? At least say me how to identify what apis should be ported?

like image 225
Claudio Junior Avatar asked Dec 17 '25 10:12

Claudio Junior


1 Answers

This code should work:

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.

might work(at least on Preview Release), but not permitted. Windows App Cert Kit says:

   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. 
    :
    :
like image 62
sumomoneko Avatar answered Dec 20 '25 00:12

sumomoneko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!