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:
1919
2020Example main func:
2121```
22+ #include <iostream>
2223#include <wsjcpp_sql_builder.h>
2324
2425int 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
3639Example 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```
Original file line number Diff line number Diff line change 1- #include < string.h>
21#include < iostream>
32#include < wsjcpp_sql_builder.h>
43
You can’t perform that action at this time.
0 commit comments