2929#include < wsjcpp_sql_builder.h>
3030
3131int main () {
32- WsjcppSqlBuilder builder;
33- builder.deleteFrom (" table4" )
34- .where ()
35- .equal (" col1" , " 1" )
36- .or_ ()
37- .notEqual (" col2" , " 2" )
38- .or_ ()
39- .subCondition ()
40- .equal (" c3" , " 4" )
41- // .and_() // be default must be added and
42- .equal (" col2" , " 5" )
43- .finishSubCondition ()
44- .or_ ()
45- .lessThen (" col4" , 111 )
46- ;
32+ WsjcppSqlBuilder builder;
33+ builder.deleteFrom (" table4" )
34+ .where ()
35+ .equal (" col1" , " 1" )
36+ .or_ ()
37+ .notEqual (" col2" , " 2" )
38+ .or_ ()
39+ .subCondition ()
40+ .equal (" c3" , " 4" )
41+ // .and_() // be default must be added and
42+ .equal (" col2" , " 5" )
43+ .finishSubCondition ()
44+ .or_ ()
45+ .lessThen (" col4" , 111 )
46+ ;
4747
48- if (builder.hasErrors ()) {
49- std::cerr << " Select builder has some errors" << std::endl;
50- return -1 ;
51- }
52- std::string sqlQuery = builder.sql ();
53- std::string sqlQueryExpected = " DELETE FROM table4 WHERE col1 = '1' OR col2 <> '2' OR (c3 = '4' AND col2 = '5') OR col4 < 111" ;
54- if (sqlQuery != sqlQueryExpected) {
55- std::cerr
56- << " Expected:" << std::endl
57- << " {" << sqlQueryExpected << " }" << std::endl
58- << " , but got:" << std::endl
59- << " {" << sqlQuery << " }" << std::endl
60- ;
61- return -1 ;
62- }
48+ if (builder.hasErrors ()) {
49+ std::cerr << " Select builder has some errors" << std::endl;
50+ return -1 ;
51+ }
52+ std::string sqlQuery = builder.sql ();
53+ std::string sqlQueryExpected = " DELETE FROM table4 WHERE col1 = '1' OR col2 <> '2' OR (c3 = '4' AND col2 = '5') OR col4 < 111" ;
54+ if (sqlQuery != sqlQueryExpected) {
55+ std::cerr
56+ << " Expected:" << std::endl
57+ << " {" << sqlQueryExpected << " }" << std::endl
58+ << " , but got:" << std::endl
59+ << " {" << sqlQuery << " }" << std::endl
60+ ;
61+ return -1 ;
62+ }
6363
64- return 0 ;
64+ return 0 ;
6565}
0 commit comments