45 lines
1013 B
C
45 lines
1013 B
C
|
|
/**
|
||
|
|
* @file mix_cc/sql/insert_into.h
|
||
|
|
* @brief 插入 语句
|
||
|
|
* @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/column.h>
|
||
|
|
#include <mix_cc/sql/statement.h>
|
||
|
|
#include <mix_cc/sql/set.h>
|
||
|
|
|
||
|
|
namespace mix_cc {
|
||
|
|
namespace sql {
|
||
|
|
template <typename Tab>
|
||
|
|
struct insert_into_t : public prev_statement_t<void>, public statement_t {
|
||
|
|
static constexpr auto s_text = op::cmd_t::insert_into;
|
||
|
|
constexpr explicit insert_into_t(Tab table)
|
||
|
|
: prev_statement_t<void>(), table_(table) {}
|
||
|
|
|
||
|
|
template <typename... Values>
|
||
|
|
constexpr auto set(Values... values) {
|
||
|
|
return set_t(*this, values...);
|
||
|
|
}
|
||
|
|
|
||
|
|
constexpr auto get_command() {
|
||
|
|
return s_text + " "_s + table_.get_table_name();
|
||
|
|
}
|
||
|
|
|
||
|
|
public:
|
||
|
|
Tab table_;
|
||
|
|
};
|
||
|
|
|
||
|
|
template <typename Tab>
|
||
|
|
auto insert_into(Tab table) {
|
||
|
|
return insert_into_t<Tab>(table);
|
||
|
|
}
|
||
|
|
} // namespace sql
|
||
|
|
} // namespace mix_cc
|