This commit is contained in:
Scott E. Graves 2024-10-08 13:23:19 -05:00
parent ec8b7783f3
commit 37d393c1f9
2 changed files with 7 additions and 8 deletions

View File

@ -454,7 +454,7 @@ template <typename ctx_t, typename op_t> struct db_where_t final {
for (auto &&action : data.actions) {
std::visit(overloaded{
[&idx, &stream](const comp_data_t &comp) {
stream << comp.column_name << comp.op_type
stream << '"' << comp.column_name << '"' << comp.op_type
<< '?' + std::to_string(++idx);
},
[&idx, &stream](const n_t &next) {
@ -517,7 +517,7 @@ template <typename ctx_t, typename op_t> struct db_where_with_limit_t final {
for (auto &&action : data.actions) {
std::visit(overloaded{
[&idx, &stream](const comp_data_t &comp) {
stream << comp.column_name << comp.op_type
stream << '"' << comp.column_name << '"' << comp.op_type
<< '?' + std::to_string(++idx);
},
[&idx, &stream](const n_t &next) {

View File

@ -143,7 +143,7 @@ TEST_F(database_test, db_delete_where_query) {
.equals("test2");
auto query_str = query.dump();
std::cout << query_str << std::endl;
EXPECT_STREQ(R"(DELETE FROM "table" WHERE ("column1"=?1 AND "column2"=?2);)",
EXPECT_STREQ(R"(DELETE FROM "table" WHERE "column1"=?1 AND "column2"=?2;)",
query_str.c_str());
}
@ -185,9 +185,8 @@ TEST_F(database_test, db_select_where_query) {
.equals("test2");
auto query_str = query.dump();
std::cout << query_str << std::endl;
EXPECT_STREQ(
R"(SELECT * FROM "table" WHERE ("column1"=?1 AND "column2"=?2);)",
query_str.c_str());
EXPECT_STREQ(R"(SELECT * FROM "table" WHERE "column1"=?1 AND "column2"=?2;)",
query_str.c_str());
}
TEST_F(database_test, db_select_columns_query) {
@ -202,7 +201,7 @@ TEST_F(database_test, db_select_columns_query) {
auto query_str = query.dump();
std::cout << query_str << std::endl;
EXPECT_STREQ(
R"(SELECT column1, column2 FROM "table" WHERE ("column1"=?1 AND "column2"=?2);)",
R"(SELECT column1, column2 FROM "table" WHERE "column1"=?1 AND "column2"=?2;)",
query_str.c_str());
}
@ -217,7 +216,7 @@ TEST_F(database_test, db_update_query) {
auto query_str = query.dump();
std::cout << query_str << std::endl;
EXPECT_STREQ(
R"(UPDATE "table" SET "column1"=?1 WHERE ("column1"=?2 AND "column2"=?3);)",
R"(UPDATE "table" SET "column1"=?1 WHERE "column1"=?2 AND "column2"=?3;)",
query_str.c_str());
}