-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_3.cpp
60 lines (51 loc) · 1.59 KB
/
test_3.cpp
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
54
55
56
57
58
59
60
#include <iostream>
#include "SQLiteWrapper.h"
int main() {
SQLiteWrapper sqlite;
if (sqlite.Open("SQLiteWrapper.db")) {
std::cout << "SQLiteWrapper.db created or opened" << std::endl;
}
else {
std::cout << "couldn't open SQLiteWrapper.db" << std::endl;
}
SQLiteStatement* stmt = sqlite.Statement("insert into foo values (?, ?)");
if (stmt->Bind(0, 3)) {
std::cout << "value 3 successfully bound at pos 0" << std::endl;
}
else {
std::cout << "value 3 NOT successfully bound at pos 0: " << sqlite.LastError() << std::endl;
}
if (stmt->Bind(1, 4)) {
std::cout << "value 4 successfully bound at pos 1" << std::endl;
}
else {
std::cout << "value 4 NOT successfully bound at pos 1:" << sqlite.LastError() << std::endl;
}
// ******************************** Executing 1st time
if (stmt->Execute()) {
std::cout << "statement executed" << std::endl;
}
else {
std::cout << "error executing statement: " << sqlite.LastError() << std::endl;
}
if (stmt->Bind(0, 5)) {
std::cout << "value 5 successfully bound at pos 0" << std::endl;
}
else {
std::cout << "value 5 NOT successfully bound at pos 0" << std::endl;
}
if (stmt->Bind(1, 6)) {
std::cout << "value 6 successfully bound at pos 1" << std::endl;
}
else {
std::cout << "value 6 NOT successfully bound at pos 1" << std::endl;
}
// ******************************** Executing 2nd time
if (stmt->Execute()) {
std::cout << "statement executed" << std::endl;
}
else {
std::cout << "error executing statement: " << sqlite.LastError() << std::endl;
}
return 0;
}