-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathSQLiteTempTable.cpp
More file actions
43 lines (34 loc) · 1.07 KB
/
SQLiteTempTable.cpp
File metadata and controls
43 lines (34 loc) · 1.07 KB
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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "Public/winget/SQLiteTempTable.h"
#include "AppInstallerStrings.h"
namespace AppInstaller::SQLite
{
using namespace std::string_view_literals;
TempTable::TempTable()
{
GUID tempName;
THROW_IF_FAILED(CoCreateGuid(&tempName));
wchar_t guidAsString[MAX_PATH];
THROW_HR_IF(E_UNEXPECTED, StringFromGUID2(tempName, guidAsString, MAX_PATH) == 0);
m_name = Utility::ConvertToUTF8(guidAsString);
}
TempTable::~TempTable()
{
if (m_dropTableStatement)
{
m_dropTableStatement.Execute();
}
}
Builder::QualifiedTable TempTable::GetQualifiedName() const
{
return Builder::QualifiedTable("temp"sv, m_name);
}
void TempTable::InitDropStatement(const Connection& connection)
{
Builder::StatementBuilder builder;
builder.DropTable(m_name);
m_dropTableStatement = builder.Prepare(connection);
}
}