blob: e67dcb83b23dc363124addc4d5c9e91d54e2f769 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include "sqlite3.h"
using namespace vsixtest;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
MainPage::MainPage()
{
InitializeComponent();
UseSQLite();
}
void MainPage::UseSQLite(void)
{
int rc = SQLITE_OK;
sqlite3 *pDb = nullptr;
rc = sqlite3_open_v2("test.db", &pDb,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
if (rc != SQLITE_OK)
throw ref new FailureException("Failed to open database.");
rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr);
if (rc != SQLITE_OK)
throw ref new FailureException("Failed to vacuum database.");
rc = sqlite3_close(pDb);
if (rc != SQLITE_OK)
throw ref new FailureException("Failed to close database.");
pDb = nullptr;
}
|