Add a proof of concept test for copy() with assymetric IC::DT
What a mess. The core of the problem is that some of our IC::DT in/deflator
pairs are *not* symmetric. That is for things to roundtrip one needs values
to pass through the database, which is configured "just properly wrong" to
perform the second half of this evil dance.
Of course this break copy() and likely other things I do not know about.
Given there is nothing one can do about the core problem (huge install base)
a minimally invasive workaround has been devised and tested here. Refer to
`git show 993fa9b | perl -ne 'print if 110..134'` for the exact snippet you
need to place in your base result class to make everything work again.
This is terrible.
-- ribasushi
For completeness: here is a full list of individual inflators (as of Apr
2016) and which ones are broken beyond repair:
ACCESS 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
DB2 2016-04-13-07.42.58 2016-04-13T07:42:58 2016-04-13-07.42.58 (via DateTime::Format::DB2)
MSSQL 2016-04-13 07:42:58.000 2016-04-13T07:42:58 2016-04-13 07:42:58.000 (via DBIx::Class::Storage::DBI::MSSQL::DateTime::Format)
Pg 2016-04-13 07:42:58+0000 2016-04-13T07:42:58 2016-04-13 07:42:58+0000 (via DateTime::Format::Pg)
ADO 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
NoBindVars 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
SQLAnywhere 2016-04-13 07:42:58.000000 2016-04-13T07:42:58 2016-04-13 07:42:58.000000 (via DateTime::Format::Strptime)
AutoCast 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
Firebird 2016-04-13 07:42:58.0000 2016-04-13T07:42:58 2016-04-13 07:42:58.0000 (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Informix 2016-04-13 07:42:58.00000 2016-04-13T07:42:58 2016-04-13 07:42:58.00000 (via DBIx::Class::Storage::DBI::Informix::DateTime::Format)
ODBC 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
Sybase 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
mysql 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
InterBase 2016-04-13 07:42:58.0000 2016-04-13T07:42:58 2016-04-13 07:42:58.0000 (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Oracle 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
SQLite 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::SQLite)
Firebird::Common 2016-04-13 07:42:58.0000 2016-04-13T07:42:58 2016-04-13 07:42:58.0000 (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Sybase::FreeTDS 2016-04-13 07:42:58 2016-04-13T07:42:58 2016-04-13 07:42:58 (via DateTime::Format::MySQL)
Sybase::MSSQL 2016-04-13 07:42:58.000 Your datetime does not match your pattern. at (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::Microsoft_SQL_Server 2016-04-13 07:42:58.000 Your datetime does not match your pattern. at (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::ASE 04/13/2016 07:42:58.000 Your datetime does not match your pattern. at (via DBIx::Class::Storage::DBI::Sybase::ASE::DateTime::Format)
Sybase::Microsoft_SQL_Server::NoBindVars 2016-04-13 07:42:59.000 Your datetime does not match your pattern. at (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::ASE::NoBindVars 04/13/2016 07:42:59.000 Your datetime does not match your pattern. at (via DBIx::Class::Storage::DBI::Sybase::ASE::DateTime::Format)
Oracle::WhereJoins 2016-04-13 07:42:59 2016-04-13T07:42:59 2016-04-13 07:42:59 (via DateTime::Format::Oracle)
Oracle::Generic 2016-04-13 07:42:59 2016-04-13T07:42:59 2016-04-13 07:42:59 (via DateTime::Format::Oracle)
ODBC::ACCESS 2016-04-13 07:42:59 2016-04-13T07:42:59 2016-04-13 07:42:59 (via DBIx::Class::Storage::DBI::ODBC::ACCESS::DateTime::Format)
ODBC::DB2_400_SQL 2016-04-13-07.42.59 2016-04-13T07:42:59 2016-04-13-07.42.59 (via DateTime::Format::DB2)
ODBC::SQL_Anywhere 2016-04-13 07:42:59.000000 2016-04-13T07:42:59 2016-04-13 07:42:59.000000 (via DateTime::Format::Strptime)
ODBC::Firebird 2016-04-13 07:42:59.0000 2016-04-13T07:42:59 2016-04-13 07:42:59.0000 (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
ODBC::Microsoft_SQL_Server 2016-04-13 07:42:59.000 2016-04-13T07:42:59 2016-04-13 07:42:59.000 (via DBIx::Class::Storage::DBI::MSSQL::DateTime::Format)
ADO::MS_Jet 04/13/2016 07:42:59 AM 2016-04-13T07:42:59 04/13/2016 07:42:59 AM (via DBIx::Class::Storage::DBI::ADO::MS_Jet::DateTime::Format)
ADO::Microsoft_SQL_Server 04/13/2016 07:42:59 AM 2016-04-13T07:42:59 04/13/2016 07:42:59 AM (via DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format)
... and the program that produces the above ...
~$ perl -I lib -MDateTime -MFile::Find -e '
find({ no_chdir => 1, follow_fast => 1, wanted => sub {
-f _ or next;
$_ =~ m{DBIx/Class/Storage/DBI/(?!Replicated|IdentityInsert|.*?Cursor|UniqueIdentifier)(.+)\.pm} or next;
list_dt_state($1);
}}, "lib" );
sub list_dt_state {
( my $id = shift ) =~ s|/|::|g;
my $s = "DBIx::Class::Storage::DBI::$id";
my $p = eval "local \$SIG{__WARN__} = sub {}; require $s; $s->build_datetime_parser"
or ( printf "%s: %s\n", $id, substr $@, 0, 45 and next );
my $as_string = $p->format_datetime( DateTime->now );
my $half_trip = eval { $p->parse_datetime( $as_string ) } || substr $@, 0, 45;
my $full_trip = $@ ? "" : eval { $p->format_datetime( $half_trip ) } || substr $@, 0, 45;
printf "%-30s %-26s %-20s %-26s (via %s)\n",
$id,
$as_string,
$half_trip,
$full_trip,
( ref $p || $p ),
;
}
'