Skip to content

Commit

Permalink
bug修改
Browse files Browse the repository at this point in the history
  • Loading branch information
NoWhere-NowHere-TLD committed Aug 28, 2024
1 parent 87abc70 commit 07f2526
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@
*build*
.vscode
.cache
/.vs
/CMakeSettings.json
2 changes: 1 addition & 1 deletion ormpp/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ inline void get_sql_conditions(std::string &sql, const std::string &arg,
auto pos = sql.find("where");
sql = sql.substr(0, pos);
}
if (arg.find("limit") != std::string::npos) {
if (temp.find("limit") != std::string::npos) {
auto pos = sql.find("where");
sql = sql.substr(0, pos);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_ormpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,8 @@ TEST_CASE("query_s delete_records_s") {
auto vec5 = sqlite.query_s<person>("name=? and age=?", "purecpp", 200);
auto vec6 =
sqlite.query_s<person>("select * from person where name=?", "purecpp");
auto vec11 =
sqlite.query_s<person>("SELECT * FROM PERSON WHERE NAME=?", "purecpp");
auto vec7 = sqlite.query_s<person>("name=?", "purecpp' or '1=1");
sqlite.delete_records_s<person>("name=?", "purecpp' or '1=1");
auto vec8 = sqlite.query_s<person>();
Expand All @@ -1415,6 +1417,7 @@ TEST_CASE("query_s delete_records_s") {
CHECK(vec8.size() == 2);
CHECK(vec9.size() == 1);
CHECK(vec10.size() == 0);
CHECK(vec11.front().age == 200);
}
#endif
}
Expand Down

0 comments on commit 07f2526

Please sign in to comment.