Alternate
e697dbe9c5997e35395fe158628dd8c5209481da
for Visual Studio 2022 and Windows 11.
読み取り中…
検索中…
一致する文字列を見つけられません
Engine.h
[詳解]
1
5
6
#pragma once
7
8
#include <Windows.h>
9
#include "
sqlite3.h
"
10
#include "
Core.h
"
11
12
namespace
alt
13
{
14
namespace
db
15
{
18
class
Engine
:
public
Core
19
{
20
public
:
22
Engine
()
23
:
Core
()
24
{
25
_engine
=
nullptr
;
26
_lastError
=
SQLITE_OK
;
27
}
28
30
virtual
~Engine
()
31
{
32
if
(
_engine
!=
nullptr
)
Close
();
33
}
34
36
LPCTSTR
GetErrorMessage
()
37
{
38
return
(LPCTSTR)
::sqlite3_errmsg16
(
_engine
);
39
}
40
43
bool
Create
(LPCTSTR lpctszDBName)
44
{
45
_lastError
=
::sqlite3_open16
(lpctszDBName, &
_engine
);
46
return
getResponse
();
47
}
48
50
bool
Close
()
51
{
52
_lastError
=
::sqlite3_close
(
_engine
);
53
_engine
=
nullptr
;
54
return
getResponse
();
55
}
56
59
bool
Execute
(LPCSTR lpcszSQL)
60
{
61
_lastError
=
::sqlite3_exec
(
_engine
, lpcszSQL,
nullptr
,
nullptr
,
nullptr
);
62
return
getResponse
();
63
}
64
66
bool
BeginTransaction
()
67
{
68
return
Execute
(
"BEGIN;"
);
69
}
70
72
bool
CommitTransaction
()
73
{
74
return
Execute
(
"COMMIT;"
);
75
}
76
78
bool
RollbackTransaction
()
79
{
80
return
Execute
(
"ROLLBACK;"
);
81
}
82
84
bool
Vacuum
()
85
{
86
return
Execute
(
"VACUUM;"
);
87
}
88
90
ULONGLONG
GetLastRowID
()
91
{
92
return ::sqlite3_last_insert_rowid (
_engine
);
93
}
94
96
sqlite3
*
GetEngine
()
97
{
98
return
_engine
;
99
}
100
101
protected
:
103
sqlite3
*
_engine
;
104
};
105
}
106
}
Core.h
SqLite3操作クラス(Core)
alt::db::Core
SqLite3操作クラス(Core)
Definition:
Core.h:19
alt::db::Core::getResponse
bool getResponse()
各関数の戻り値判定共通
Definition:
Core.h:29
alt::db::Core::_lastError
int _lastError
SQLite3関数エラー値
Definition:
Core.h:32
alt::db::Engine
SqLite3操作クラス(Engine)
Definition:
Engine.h:19
alt::db::Engine::GetLastRowID
ULONGLONG GetLastRowID()
最後の実行時のROWIDを取得
Definition:
Engine.h:90
alt::db::Engine::GetErrorMessage
LPCTSTR GetErrorMessage()
エラーメッセージの取得
Definition:
Engine.h:36
alt::db::Engine::GetEngine
sqlite3 * GetEngine()
エンジン部を取得
Definition:
Engine.h:96
alt::db::Engine::Vacuum
bool Vacuum()
空き領域の整理
Definition:
Engine.h:84
alt::db::Engine::Close
bool Close()
DBファイルのクローズ
Definition:
Engine.h:50
alt::db::Engine::~Engine
virtual ~Engine()
デストラクタ
Definition:
Engine.h:30
alt::db::Engine::Engine
Engine()
コンストラクタ
Definition:
Engine.h:22
alt::db::Engine::BeginTransaction
bool BeginTransaction()
トランザクション開始
Definition:
Engine.h:66
alt::db::Engine::RollbackTransaction
bool RollbackTransaction()
トランザクションロールバック
Definition:
Engine.h:78
alt::db::Engine::_engine
sqlite3 * _engine
SQLite3コンテキスト
Definition:
Engine.h:103
alt::db::Engine::CommitTransaction
bool CommitTransaction()
トランザクションコミット
Definition:
Engine.h:72
alt::db::Engine::Create
bool Create(LPCTSTR lpctszDBName)
DBファイルの作成・オープン
Definition:
Engine.h:43
alt::db::Engine::Execute
bool Execute(LPCSTR lpcszSQL)
SQLステートメント実行
Definition:
Engine.h:59
alt
Definition:
DBLibrary.h:12
sqlite3.h
sqlite3
struct sqlite3 sqlite3
Definition:
sqlite3.h:249
SQLITE_OK
#define SQLITE_OK
Definition:
sqlite3.h:425
sqlite3_exec
SQLITE_API int sqlite3_exec(sqlite3 *, const char *sql, int(*callback)(void *, int, char **, char **), void *, char **errmsg)
sqlite3_errmsg16
SQLITE_API const void * sqlite3_errmsg16(sqlite3 *)
sqlite3_close
SQLITE_API int sqlite3_close(sqlite3 *)
sqlite3_open16
SQLITE_API int sqlite3_open16(const void *filename, sqlite3 **ppDb)
DBLibrary
SQLite3
Engine.h
構築:
1.9.6