41 lines
955 B
C
41 lines
955 B
C
|
|
/**
|
||
|
|
* @file mix_cc/sql/from.h
|
||
|
|
* @brief FROM 语句
|
||
|
|
* @author Cat (null.null.null@qq.com)
|
||
|
|
* @version 0.1
|
||
|
|
* @date 2021-09-17
|
||
|
|
*
|
||
|
|
* Copyright: Baosight Co. Ltd.
|
||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
#pragma once
|
||
|
|
#include <mix_cc/sql/public.h>
|
||
|
|
#include <mix_cc/sql/statement.h>
|
||
|
|
#include <mix_cc/sql/where.h>
|
||
|
|
|
||
|
|
namespace mix_cc {
|
||
|
|
namespace sql {
|
||
|
|
template <typename PrevStatement, typename Tab>
|
||
|
|
struct from_t : public prev_statement_t<PrevStatement>, public statement_t {
|
||
|
|
static constexpr auto s_text = op::cmd_t::from;
|
||
|
|
|
||
|
|
constexpr explicit from_t(PrevStatement prev_st, Tab tab)
|
||
|
|
: prev_statement_t<PrevStatement>(prev_st) {
|
||
|
|
table_ = tab;
|
||
|
|
}
|
||
|
|
|
||
|
|
template <typename... Conditions>
|
||
|
|
constexpr auto where(Conditions... conditions) {
|
||
|
|
return where_t(*this, conditions...);
|
||
|
|
}
|
||
|
|
|
||
|
|
constexpr auto get_command() {
|
||
|
|
return " "_s + s_text + " "_s + table_.get_table_name();
|
||
|
|
}
|
||
|
|
|
||
|
|
Tab table_;
|
||
|
|
};
|
||
|
|
} // namespace sql
|
||
|
|
} // namespace mix_cc
|