This commit is contained in:
parent
284e2a3ead
commit
1ff62fb2b5
@ -45,8 +45,8 @@ public:
|
|||||||
using w_t = db_where_t<context, db_delete_op_t>;
|
using w_t = db_where_t<context, db_delete_op_t>;
|
||||||
|
|
||||||
std::optional<w_t> where;
|
std::optional<w_t> where;
|
||||||
|
std::map<std::size_t, std::vector<w_t::action_t>> where_actions;
|
||||||
std::vector<db_types_t> where_values;
|
std::vector<db_types_t> where_values;
|
||||||
std::map<std::size_t, std::vector<w_t::action_t>> actions;
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
@ -58,8 +58,8 @@ public:
|
|||||||
std::optional<std::int32_t> limit;
|
std::optional<std::int32_t> limit;
|
||||||
std::optional<std::pair<std::string, bool>> order_by;
|
std::optional<std::pair<std::string, bool>> order_by;
|
||||||
std::optional<w_t> where;
|
std::optional<w_t> where;
|
||||||
|
std::map<std::size_t, std::vector<w_t::action_t>> where_actions;
|
||||||
std::vector<db_types_t> where_values;
|
std::vector<db_types_t> where_values;
|
||||||
std::map<std::size_t, std::vector<w_t::action_t>> actions;
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
@ -53,8 +53,8 @@ public:
|
|||||||
std::optional<std::int32_t> limit;
|
std::optional<std::int32_t> limit;
|
||||||
std::optional<std::pair<std::string, bool>> order_by;
|
std::optional<std::pair<std::string, bool>> order_by;
|
||||||
std::optional<w_t> where;
|
std::optional<w_t> where;
|
||||||
|
std::map<std::size_t, std::vector<w_t::action_t>> where_actions;
|
||||||
std::vector<db_types_t> where_values;
|
std::vector<db_types_t> where_values;
|
||||||
std::map<std::size_t, std::vector<w_t::action_t>> actions;
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ struct db_where_next_t final {
|
|||||||
"AND",
|
"AND",
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx->actions[action_idx].emplace_back(next);
|
ctx->where_actions[action_idx].emplace_back(next);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ struct db_where_next_t final {
|
|||||||
"OR",
|
"OR",
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx->actions[action_idx].emplace_back(next);
|
ctx->where_actions[action_idx].emplace_back(next);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -111,7 +111,7 @@ struct db_comp_next_t final {
|
|||||||
using wn_t = db_where_next_t<db_comp_next_t, ctx_t, op_t, w_t>;
|
using wn_t = db_where_next_t<db_comp_next_t, ctx_t, op_t, w_t>;
|
||||||
|
|
||||||
[[nodiscard]] auto create(std::string operation, db_types_t value) {
|
[[nodiscard]] auto create(std::string operation, db_types_t value) {
|
||||||
ctx->actions[action_idx].emplace_back(db_comp_data_t{
|
ctx->where_actions[action_idx].emplace_back(db_comp_data_t{
|
||||||
column_name,
|
column_name,
|
||||||
operation,
|
operation,
|
||||||
});
|
});
|
||||||
@ -177,24 +177,24 @@ template <typename ctx_t, typename op_t> struct db_where_t final {
|
|||||||
[[nodiscard]] auto dump() const -> std::string { return op_t{ctx}.dump(); }
|
[[nodiscard]] auto dump() const -> std::string { return op_t{ctx}.dump(); }
|
||||||
|
|
||||||
[[nodiscard]] auto dump(std::int32_t &idx) const -> std::string {
|
[[nodiscard]] auto dump(std::int32_t &idx) const -> std::string {
|
||||||
return dump(idx, ctx->actions[action_idx]);
|
return dump(idx, ctx->where_actions[action_idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_actions() -> auto & {
|
[[nodiscard]] auto get_actions() -> auto & {
|
||||||
return ctx->actions[action_idx];
|
return ctx->where_actions[action_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_actions() const -> const auto & {
|
[[nodiscard]] auto get_actions() const -> const auto & {
|
||||||
return ctx->actions[action_idx];
|
return ctx->where_actions[action_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto group(group_func_t func) -> wn_t {
|
[[nodiscard]] auto group(group_func_t func) -> wn_t {
|
||||||
ctx->actions[action_idx];
|
ctx->where_actions[action_idx];
|
||||||
|
|
||||||
db_where_t where{ctx->actions.size(), ctx};
|
db_where_t where{ctx->where_actions.size(), ctx};
|
||||||
func(where);
|
func(where);
|
||||||
|
|
||||||
ctx->actions[action_idx].emplace_back(where);
|
ctx->where_actions[action_idx].emplace_back(where);
|
||||||
|
|
||||||
return wn_t{
|
return wn_t{
|
||||||
action_idx,
|
action_idx,
|
||||||
@ -203,7 +203,7 @@ template <typename ctx_t, typename op_t> struct db_where_t final {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto where(std::string column_name) -> cn_t {
|
[[nodiscard]] auto where(std::string column_name) -> cn_t {
|
||||||
ctx->actions[action_idx];
|
ctx->where_actions[action_idx];
|
||||||
|
|
||||||
return cn_t{
|
return cn_t{
|
||||||
action_idx,
|
action_idx,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user