31 lines
1.0 KiB
C++
31 lines
1.0 KiB
C++
#include "postgres_dialect.hpp"
|
|
|
|
#include "matador/sql/dialect_builder.hpp"
|
|
|
|
#include "matador/utils/basic_types.hpp"
|
|
|
|
[[maybe_unused]] const matador::sql::dialect *get_dialect()
|
|
{
|
|
using namespace matador::sql;
|
|
const static dialect d = dialect_builder::builder()
|
|
.create()
|
|
.with_placeholder_func([](const size_t index) {
|
|
return "$" + std::to_string(index);
|
|
})
|
|
.with_token_replace_map({
|
|
{dialect_token::BEGIN_BINARY_DATA, "'\\x"}
|
|
})
|
|
.with_data_type_replace_map({
|
|
{matador::utils::basic_type::type_int8, "SMALLINT"},
|
|
{matador::utils::basic_type::type_uint8, "SMALLINT"},
|
|
{matador::utils::basic_type::type_float, "REAL"},
|
|
{matador::utils::basic_type::type_double, "DOUBLE PRECISION"},
|
|
{matador::utils::basic_type::type_time, "TIMESTAMP"},
|
|
{matador::utils::basic_type::type_blob, "BYTEA"}
|
|
})
|
|
.with_bool_strings("TRUE", "FALSE")
|
|
.with_default_schema_name("public")
|
|
.build();
|
|
return &d;
|
|
}
|