diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 7c2c58e7e..d37864530 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -1793,12 +1793,10 @@ Without doing this the query will contain the simple stringification of the C object, which almost never matches the RDBMS expectations. This kludge is necessary only for conditions passed to -L, whereas -L, -L, -L (but not L) are all -L-aware and will do the right thing when supplied -an inflated C object. +L and L, +whereas L, L (but +not L) are L-aware +and will do the right thing when supplied an inflated C object. =head2 Using Unicode diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index 4a78e24d8..c3daebc32 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -262,6 +262,38 @@ alter session statements on database connection establishment: ->on_connect_do("ALTER SESSION SET NLS_SORT = 'BINARY_CI'"); ->on_connect_do("ALTER SESSION SET NLS_SORT = 'GERMAN_CI'"); +=item .. format a DateTime object for searching? + +L and L +do not take L into account, and so your C +object will not be correctly deflated into a format your RDBMS expects. + +The L method on your +storage object can be used to return the object that would normally do this, so +it's easy to do it manually: + + my $dtf = $schema->storage->datetime_parser; + my $rs = $schema->resultset('users')->search( + { + signup_date => { + -between => [ + $dtf->format_datetime($dt_start), + $dtf->format_datetime($dt_end), + ], + } + }, + ); + +From a Row class, you can get this from the +L|DBIx::Class::Row/result_source>. + + my $dtf = $self->result_source->storage->datetime_parser; + +This kludge is necessary only for conditions passed to +L and L, +whereas L, L (but +not L) are L-aware +and will do the right thing when supplied an inflated C object. =back diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 4e67f1b4d..5d918a5eb 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1667,8 +1667,8 @@ sub _gen_sql_bind { ) { carp_unique 'DateTime objects passed to search() are not supported ' . 'properly (InflateColumn::DateTime formats and settings are not ' - . 'respected.) See "Formatting DateTime objects in queries" in ' - . 'DBIx::Class::Manual::Cookbook. To disable this warning for good ' + . 'respected.) See ".. format a DateTime object for searching?" in ' + . 'DBIx::Class::Manual::FAQ. To disable this warning for good ' . 'set $ENV{DBIC_DT_SEARCH_OK} to true' }