Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create_task(
- KnownFolders::DocumentsLibrary->CreateFileAsync(
- L"KatchupDatabase.kat",
- CreationCollisionOption::OpenIfExists
- )
- ).then([&](StorageFile^ file) {
- if(!file) {
- throw task_canceled("Unable to create database file.");
- }
- wstring wfilePath = file->Path->Data();
- string filePath;
- filePath.assign(begin(wfilePath), end(wfilePath));
- char* err = nullptr;
- sqlite3* db = nullptr;
- sqlite3_open(filePath.c_str(), &db);
- auto rc = sqlite3_exec(db, "CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z);", nullptr, nullptr, &err);
- if(rc != SQLITE_OK) {
- cout << err << endl;
- sqlite3_free(err);
- }
- sqlite3_close(db);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement