8 use Data::Query::ExprDeclare;
9 use Data::Query::ExprHelpers;
11 use DBIC::SqlMakerTest;
13 my $schema = DBICTest->init_schema();
15 $schema->source($_)->resultset_class('DBIx::Class::ResultSet::WithDQMethods')
18 my $cds = $schema->resultset('CD');
21 $cds->_remap_identifiers(Identifier('name'))
22 } qr/Invalid name on me: name/;
25 [ $cds->_remap_identifiers(Identifier('title')) ],
26 [ Identifier('me', 'title'), [] ],
31 [ $cds->_remap_identifiers(Identifier('artist', 'name')) ],
32 [ Identifier('artist', 'name'), [ { artist => {} } ] ],
37 [ $cds->search({}, { join => { single_track => { cd => 'artist' } } })
38 ->_remap_identifiers(Identifier('artist', 'name')) ],
39 [ Identifier('artist_2', 'name'), [ { artist => {} } ] ],
40 'Remap column on rel with re-alias'
44 [ $cds->_remap_identifiers(Identifier('artist_id')) ],
45 [ Identifier('me', 'artist'), [] ],
46 'Remap column w/column name rename'
49 my $double_name = expr { $_->artist->name == $_->artist->name }->{expr};
52 [ $cds->_remap_identifiers($double_name) ],
53 [ $double_name, [ { artist => {} } ] ],
54 'Remap column on rel only adds rel once'