File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -19,23 +19,25 @@ or include this files:
19
19
20
20
Example main func:
21
21
```
22
+ #include <iostream>
22
23
#include <wsjcpp_sql_builder.h>
23
24
24
25
int main(int argc, const char* argv[]) {
25
- // init employees
26
- bool bSilent = false;
27
- WsjcppEmployeesInit empls({}, bSilent);
28
- if (!empls.inited) {
29
- WsjcppLog::err(TAG, "Could not init employees");
26
+ WsjcppSqlBuilderInsert sql("TABLE_NAME");
27
+ sql.add("COL1", "val1"); // will be escaped
28
+ sql.add("COL2", 1);
29
+ // sql.add("COL3", 1.1);
30
+ if (!sql.isValid()) {
31
+ std::cerr << "Something wrong with query: " << sql.getErrorMessage() << std::endl;
30
32
return -1;
31
33
}
34
+ std::cout << sql.getTextQuery() << std::endl;
32
35
return 0;
33
36
}
34
37
```
35
38
36
39
Example output:
37
40
```
38
- % ./wsjcpp-employees
39
- 2020-03-22 11:32:31.750, 0x0x110c21dc0 [INFO] WJSCppEmployRuntimeGlobalCache: init
40
- 2020-03-22 11:32:31.750, 0x0x110c21dc0 [OK] Employees_init: Init WJSCppEmployRuntimeGlobalCache ... OK
41
+ $ ./wsjcpp-sql-builder
42
+ INSERT INTO TABLE_NAME(COL1, COL2) VALUES ('val1', 1);
41
43
```
Original file line number Diff line number Diff line change 1
- #include < string.h>
2
1
#include < iostream>
3
2
#include < wsjcpp_sql_builder.h>
4
3
You can’t perform that action at this time.
0 commit comments