Skip to content

Commit 66b60d6

Browse files
committed
Updated README.md
1 parent 2d9913d commit 66b60d6

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,25 @@ or include this files:
1919

2020
Example main func:
2121
```
22+
#include <iostream>
2223
#include <wsjcpp_sql_builder.h>
2324
2425
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;
3032
return -1;
3133
}
34+
std::cout << sql.getTextQuery() << std::endl;
3235
return 0;
3336
}
3437
```
3538

3639
Example output:
3740
```
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);
4143
```

src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <string.h>
21
#include <iostream>
32
#include <wsjcpp_sql_builder.h>
43

0 commit comments

Comments
 (0)