Skip to content

Commit 5b5998d

Browse files
committed
Updated readme
1 parent 47863f7 commit 5b5998d

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,58 @@
44

55
Abstraction Model for work with different databases
66

7-
TODO more description
7+
## Integrate to your project
8+
9+
```
10+
$ wsjcpp install https://github.com/wsjcpp/wsjcpp-storages:master
11+
```
12+
Or include this files:
13+
14+
* src.wsjcpp/wsjcpp_core/wsjcpp_core.h
15+
* src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp
16+
* src/wsjcpp_storages.h
17+
* src/wsjcpp_storages.cpp
18+
19+
For working with this abstruct modeles you need install subpackage for *-mysql or create yourself support database
20+
21+
Lits of supports
22+
23+
* will be soon
24+
25+
## How to use
26+
27+
Cheche the supporting database implementation
28+
```
29+
if (WsjcppStorages::support("mysql")) {
30+
// will support mysql database
31+
}
32+
```
33+
List of implemented databases:
34+
35+
```
36+
std::vector<std::string> vDbList = WsjcppStorages::list();
37+
for (int i = 0; i < vDbList.size(); i++) {
38+
std::cout << vDbList[i] << std::endl;
39+
}
40+
```
41+
42+
Create instance of storage for work with database:
43+
44+
```
45+
WsjcppStorage* pStorage = nullptr;
46+
std::string sDatabaseType = "mysql";
47+
if (WsjcppStorages::support(sDatabaseType)) {
48+
pStorage = WsjcppStorages::create(sDatabaseType);
49+
pStorage->applyConfigFromFile(sDatabaseType + ".conf"); // apply connection config
50+
}
51+
52+
// now you can create a connection to database:
53+
if (pStorage != nullptr) {
54+
WsjcppStorageConnection *pConnect = pStorage->connect();
55+
}
56+
```
57+
58+
Soon will be more information
59+
860

961

0 commit comments

Comments
 (0)