Skip to content

Commit 482c6dc

Browse files
authored
Merge pull request #667 from Weyzu/master
Ensure that CHECK's expressions are wrapped in parentheses
2 parents afa22a8 + 6960914 commit 482c6dc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

dev/statement_serializator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ namespace sqlite_orm {
498498
std::string operator()(const statement_type &c, const C &context) const {
499499
std::stringstream ss;
500500
auto leftString = serialize(c.l, context);
501+
if(context.use_parentheses) {
502+
ss << '(';
503+
}
501504
ss << leftString << " " << static_cast<std::string>(c) << " ( ";
502505
for(size_t index = 0; index < c.arg.size(); ++index) {
503506
auto &value = c.arg[index];
@@ -507,6 +510,9 @@ namespace sqlite_orm {
507510
}
508511
}
509512
ss << " )";
513+
if(context.use_parentheses) {
514+
ss << ')';
515+
}
510516
return ss.str();
511517
}
512518
};

include/sqlite_orm/sqlite_orm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10048,6 +10048,9 @@ namespace sqlite_orm {
1004810048
std::string operator()(const statement_type &c, const C &context) const {
1004910049
std::stringstream ss;
1005010050
auto leftString = serialize(c.l, context);
10051+
if(context.use_parentheses) {
10052+
ss << '(';
10053+
}
1005110054
ss << leftString << " " << static_cast<std::string>(c) << " ( ";
1005210055
for(size_t index = 0; index < c.arg.size(); ++index) {
1005310056
auto &value = c.arg[index];
@@ -10057,6 +10060,9 @@ namespace sqlite_orm {
1005710060
}
1005810061
}
1005910062
ss << " )";
10063+
if(context.use_parentheses) {
10064+
ss << ')';
10065+
}
1006010066
return ss.str();
1006110067
}
1006210068
};

0 commit comments

Comments
 (0)