-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
52 lines (42 loc) · 940 Bytes
/
main.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
#include <QCoreApplication>
#include<QDebug>
#include <sql_builder.h>
int main(int argc, char *argv[])
{
Q_UNUSED(argc);
Q_UNUSED(argv);
/*
* Select example.
*/
SQLBuilder::SqlBuilder("users")
.select({"id", "name", "registration"})
->where("id", "=", {1})
->rows();
/*
* Insert example.
*/
QVariantMap values = {
{"name", "Chaves"},
{"registration", "123456"},
};
SQLBuilder::SqlBuilder("users")
.insert(values)
->execute();
/*
* Delete example.
*/
SQLBuilder::SqlBuilder("users")
.destroy()
->where("id", "=", {14})
->execute();
/*
* Update example.
*/
QVariantMap values2;
values["name"] = "Ñoño";
values["registration"] = "654321";
SQLBuilder::SqlBuilder("users")
.update(values2)
->where("id", "=", {"4"})->execute();
return 0;
}