Skip to content

Commit

Permalink
Merge pull request #667 from Weyzu/master
Browse files Browse the repository at this point in the history
Ensure that CHECK's expressions are wrapped in parentheses
  • Loading branch information
fnc12 authored Feb 16, 2021
2 parents afa22a8 + 6960914 commit 482c6dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev/statement_serializator.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ namespace sqlite_orm {
std::string operator()(const statement_type &c, const C &context) const {
std::stringstream ss;
auto leftString = serialize(c.l, context);
if(context.use_parentheses) {
ss << '(';
}
ss << leftString << " " << static_cast<std::string>(c) << " ( ";
for(size_t index = 0; index < c.arg.size(); ++index) {
auto &value = c.arg[index];
Expand All @@ -507,6 +510,9 @@ namespace sqlite_orm {
}
}
ss << " )";
if(context.use_parentheses) {
ss << ')';
}
return ss.str();
}
};
Expand Down
6 changes: 6 additions & 0 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10048,6 +10048,9 @@ namespace sqlite_orm {
std::string operator()(const statement_type &c, const C &context) const {
std::stringstream ss;
auto leftString = serialize(c.l, context);
if(context.use_parentheses) {
ss << '(';
}
ss << leftString << " " << static_cast<std::string>(c) << " ( ";
for(size_t index = 0; index < c.arg.size(); ++index) {
auto &value = c.arg[index];
Expand All @@ -10057,6 +10060,9 @@ namespace sqlite_orm {
}
}
ss << " )";
if(context.use_parentheses) {
ss << ')';
}
return ss.str();
}
};
Expand Down

0 comments on commit 482c6dc

Please sign in to comment.