summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-27 20:53:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-27 20:53:21 +0100
commit33356e2d90cb17f688f132243aa0f8dd84c6fa57 (patch)
tree68eae2cf7bdbf46d07788b484c51b84a33f06458 /lib
parentPrevent reading of non-trivial types from RawDataReader (diff)
downloadmygrate-33356e2d90cb17f688f132243aa0f8dd84c6fa57.tar.bz2
mygrate-33356e2d90cb17f688f132243aa0f8dd84c6fa57.tar.xz
mygrate-33356e2d90cb17f688f132243aa0f8dd84c6fa57.zip
Add lots of tests over replicating most of the types
Diffstat (limited to 'lib')
-rw-r--r--lib/dbTypes.h5
-rw-r--r--lib/output/pq/typeMapper.cpp2
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/dbTypes.h b/lib/dbTypes.h
index a9ed029..8cac3ca 100644
--- a/lib/dbTypes.h
+++ b/lib/dbTypes.h
@@ -164,14 +164,11 @@ namespace MyGrate {
else if constexpr (std::is_floating_point_v<R>) {
return visit(detail::SafeExtract<R, std::is_floating_point> {});
}
- else if constexpr (std::is_same_v<std::string_view, R>) {
- return get<std::string_view>();
- }
else if constexpr (std::is_same_v<std::string, R>) {
return visit(detail::ToString {});
}
else {
- static_assert(detail::is_false<R>::value, "Cannot extract one of these");
+ return get<R>();
}
}
};
diff --git a/lib/output/pq/typeMapper.cpp b/lib/output/pq/typeMapper.cpp
index 02b0a4f..e7a4eb1 100644
--- a/lib/output/pq/typeMapper.cpp
+++ b/lib/output/pq/typeMapper.cpp
@@ -42,7 +42,7 @@ namespace MyGrate::Output::Pq {
add(R"(timestamp(\(\d+\))?)"_r, "timestamp without time zone"); // drops precision
add(R"(time)"_r, "time without time zone");
add(R"(time(\(\d+\))?)"_r, "time without time zone"); // drops precision
- add(R"(year)"_r, "smallint");
+ add(R"(year(\(\d+\))?)"_r, "smallint");
// https://dev.mysql.com/doc/refman/8.0/en/string-types.html
add(R"((var)?binary(\(\d+\))?)"_r, "bytea");
add(R"((var)?char(\(\d+\))?)"_r, "");