mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-05-02 08:59:37 -05:00
Fix serialization of PostgreSQL time data types (#504)
* Use a non-UTC timezone when testing the PostgreSQL timezone support. * Fix serialization of time of day values for PostgreSQL * Fix serialization of PostgreSQL values for "timestamp with time zone" and "time with time zone" fields.
This commit is contained in:
@@ -131,7 +131,8 @@ int TimeZone(int, char*[])
|
||||
{
|
||||
namespace sql = sqlpp::postgresql;
|
||||
|
||||
auto dbc = sql::make_test_connection();
|
||||
// We use a time zone with non-zero offset from UTC in order to catch serialization/parsing bugs
|
||||
auto dbc = sql::make_test_connection("+1");
|
||||
|
||||
dbc.execute("DROP TABLE IF EXISTS tabdatetime;");
|
||||
dbc.execute(
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace sqlpp
|
||||
}
|
||||
|
||||
// Starts a connection and sets the time zone to UTC
|
||||
inline ::sqlpp::postgresql::connection make_test_connection()
|
||||
inline ::sqlpp::postgresql::connection make_test_connection(const std::string &tz = "UTC")
|
||||
{
|
||||
namespace sql = sqlpp::postgresql;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace sqlpp
|
||||
throw;
|
||||
}
|
||||
|
||||
db.execute(R"(SET TIME ZONE 'UTC';)");
|
||||
db.execute("SET TIME ZONE " + tz + ";");
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user