arrayref) now emits a deprecation warning
* New Features
+ - When using non-scalars (e.g. arrays) as literal bind values it is no
+ longer necessary to explicitly specify a bindtype (this turned out
+ to be a mostly useless overprotection)
- DBIx::Class::Optional::Dependencies now properly understands
combinations of requirements and does the right thing with e.g.
->req_list_for([qw( rdbms_oracle ic_dt )]) bringing in the Oracle
};
return [ map {
- my $resolved =
( ref $_ ne 'ARRAY' or @$_ != 2 ) ? [ {}, $_ ]
: ( ! defined $_->[0] ) ? [ {}, $_->[1] ]
: (ref $_->[0] eq 'HASH') ? [(
: [ $resolve_bindinfo->(
{ dbic_colname => $_->[0] }
), $_->[1] ]
- ;
-
- if (
- ! exists $resolved->[0]{dbd_attrs}
- and
- ! $resolved->[0]{sqlt_datatype}
- and
- length ref $resolved->[1]
- and
- ! is_plain_value $resolved->[1]
- ) {
- require Data::Dumper;
- local $Data::Dumper::Maxdepth = 1;
- local $Data::Dumper::Terse = 1;
- local $Data::Dumper::Useqq = 1;
- local $Data::Dumper::Indent = 0;
- local $Data::Dumper::Pad = ' ';
- $self->throw_exception(
- 'You must supply a datatype/bindtype (see DBIx::Class::ResultSet/DBIC BIND VALUES) '
- . 'for non-scalar value '. Data::Dumper::Dumper ($resolved->[1])
- );
- }
-
- $resolved;
-
} @$bind ];
}
# test inferred condition for creation
for my $cond (
{ -value => [3,4] },
- \[ '= ?' => [arrayfield => [3, 4]] ],
+ \[ '= ?' => [3, 4] ],
) {
local $TODO = 'No introspection of complex literal conditions :('
if is_literal_value $cond;
'stringifyable $object === [ {}, $object ]',
);
-throws_ok {
- shorthand_check(
+shorthand_check(
[ 2 ],
- [],
- )
-} qr !You must supply a datatype/bindtype .+ for non-scalar value \Q[ 2 ]!,
- 'exception on bare array bindvalue';
+ [ {} => [ 2 ] ],
+);
-throws_ok {
- shorthand_check(
+shorthand_check(
[ {} => [ 2 ] ],
- [],
- )
-} qr !You must supply a datatype/bindtype .+ for non-scalar value \Q[ 2 ]!,
- 'exception on untyped array bindvalue';
+ [ {} => [ 2 ] ],
+);
-throws_ok {
- shorthand_check(
+shorthand_check(
[ {}, 2, 3 ],
- [],
- )
-} qr !You must supply a datatype/bindtype .+ for non-scalar value \[ 'HASH\(\w+\)', 2, 3 \]!,
- 'exception on bare multielement array bindvalue';
+ [ {} => [ {}, 2, 3 ] ],
+);
-throws_ok {
- shorthand_check(
+shorthand_check(
bless( {}, 'Foo'),
- [],
- )
-} qr !You must supply a datatype/bindtype .+ for non-scalar value \Qbless( {}, 'Foo' )!,
- 'exception on bare object';
+ [ {} => bless( {}, 'Foo') ],
+);
-throws_ok {
- shorthand_check(
+shorthand_check(
+ [ {}, bless( {}, 'Foo') ],
[ {}, bless( {}, 'Foo') ],
- [],
- )
-} qr !You must supply a datatype/bindtype .+ for non-scalar value \Qbless( {}, 'Foo' )!,
- 'exception on untyped object';
+);
sub shorthand_check {