mirror of
https://github.com/getml/sqlgen.git
synced 2026-02-14 20:58:48 -06:00
28 lines
680 B
C++
28 lines
680 B
C++
#ifndef SQLGEN_MYSQL_TO_SQL_HPP_
|
|
#define SQLGEN_MYSQL_TO_SQL_HPP_
|
|
|
|
#include <string>
|
|
#include <type_traits>
|
|
|
|
#include "../dynamic/Statement.hpp"
|
|
#include "../transpilation/to_sql.hpp"
|
|
|
|
namespace sqlgen::mysql {
|
|
|
|
/// Transpiles a dynamic general SQL statement to the mysql dialect.
|
|
std::string to_sql_impl(const dynamic::Statement& _stmt) noexcept;
|
|
|
|
/// Transpiles any SQL statement to the mysql dialect.
|
|
template <class T>
|
|
std::string to_sql(const T& _t) noexcept {
|
|
if constexpr (std::is_same_v<std::remove_cvref_t<T>, dynamic::Statement>) {
|
|
return to_sql_impl(_t);
|
|
} else {
|
|
return to_sql_impl(transpilation::to_sql(_t));
|
|
}
|
|
}
|
|
|
|
} // namespace sqlgen::mysql
|
|
|
|
#endif
|