- Fixed HRI returning too many empty results on multilevel
nonexisting prefetch
- Fixed the prefetch with limit bug
+ - New resultsed method count_rs, returns a ::ResultSetColumn
+ returning a single count value
0.08107 2009-06-14 08:21:00 (UTC)
- Fix serialization regression introduced in 0.08103 (affects
return $self->search(@_)->count if @_ and defined $_[0];
return scalar @{ $self->get_cache } if $self->get_cache;
- my $meth = $self->_has_resolved_attr (qw/collapse group_by/)
- ? 'count_grouped'
- : 'count'
- ;
-
my $attrs = $self->_resolved_attrs_copy;
+
+ # this is a little optimization - it is faster to do the limit
+ # adjustments in software, instead of a subquery
+ my $rows = delete $attrs->{rows};
+ my $offset = delete $attrs->{offset};
+
+ my $crs;
+ if ($self->_has_resolved_attr (qw/collapse group_by/)) {
+ $crs = $self->_count_subq_rs ($attrs);
+ }
+ else {
+ $crs = $self->_count_rs ($attrs);
+ }
+ my $count = $crs->next;
+
+ $count -= $offset if $offset;
+ $count = $rows if $rows and $rows < $count;
+ $count = 0 if ($count < 0);
+
+ return $count;
+}
+
+=head2 count_rs
+
+=over 4
+
+=item Arguments: $cond, \%attrs??
+
+=item Return Value: $count_rs
+
+=back
+
+Same as L</count> but returns a L<DBIx::Class::ResultSetColumn> object.
+This can be very handy for subqueries:
+
+ ->search( { amount => $some_rs->count_rs->as_query } )
+
+As with regular resultsets the SQL query will be executed only after
+the resultset is accessed via L</next> or L</all>. That would return
+the same single value obtainable via L</count>.
+
+=cut
+
+sub count_rs {
+ my $self = shift;
+ return $self->search(@_)->count_rs if @_;
+
+ # this may look like a lack of abstraction (count() does about the same)
+ # but in fact an _rs *must* use a subquery for the limits, as the
+ # software based limiting can not be ported if this $rs is to be used
+ # in a subquery itself (i.e. ->as_query)
+ if ($self->_has_resolved_attr (qw/collapse group_by offset rows/)) {
+ return $self->_count_subq_rs;
+ }
+ else {
+ return $self->_count_rs;
+ }
+}
+
+#
+# returns a ResultSetColumn object tied to the count query
+#
+sub _count_rs {
+ my ($self, $attrs) = @_;
+
+ my $rsrc = $self->result_source;
+ $attrs ||= $self->_resolved_attrs;
+
+ my $tmp_attrs = { %$attrs };
+
+ # take off any limits, record_filter is cdbi, and no point of ordering a count
+ delete $tmp_attrs->{$_} for (qw/select as rows offset order_by record_filter/);
+
+ # overwrite the selector (supplied by the storage)
+ $tmp_attrs->{select} = $rsrc->storage->_count_select ($rsrc, $tmp_attrs);
+ $tmp_attrs->{as} = 'count';
+
+ my $tmp_rs = $rsrc->resultset_class->new($rsrc, $tmp_attrs)->get_column ('count');
+
+ return $tmp_rs;
+}
+
+#
+# same as above but uses a subquery
+#
+sub _count_subq_rs {
+ my ($self, $attrs) = @_;
+
my $rsrc = $self->result_source;
+ $attrs ||= $self->_resolved_attrs_copy;
- return $rsrc->storage->$meth ($rsrc, $attrs);
+ my $sub_attrs = { %$attrs };
+
+ # these can not go in the subquery, and there is no point of ordering it
+ delete $sub_attrs->{$_} for qw/collapse select as order_by/;
+
+ # if we prefetch, we group_by primary keys only as this is what we would get out of the rs via ->next/->all
+ # clobber old group_by regardless
+ if ( keys %{$attrs->{collapse}} ) {
+ $sub_attrs->{group_by} = [ map { "$attrs->{alias}.$_" } ($rsrc->primary_columns) ]
+ }
+
+ $sub_attrs->{select} = $rsrc->storage->_subq_count_select ($rsrc, $sub_attrs);
+
+ $attrs->{from} = [{
+ count_subq => $rsrc->resultset_class->new ($rsrc, $sub_attrs )->as_query
+ }];
+
+ # the subquery replaces this
+ delete $attrs->{$_} for qw/where bind collapse group_by having having_bind rows offset/;
+
+ return $self->_count_rs ($attrs);
}
+
sub _bool {
return 1;
}
$self->{attrs}{alias} => $source->from,
} ];
- if ( exists $attrs->{join} || exists $attrs->{prefetch} ) {
+ if ( $attrs->{join} || $attrs->{prefetch} ) {
+
+ $self->throw_exception ('join/prefetch can not be used with a literal scalarref {from}')
+ if ref $attrs->{from} ne 'ARRAY';
+
my $join = delete $attrs->{join} || {};
if ( defined $attrs->{prefetch} ) {
$join = $self->_merge_attr( $join, $attrs->{prefetch} );
-
}
$attrs->{from} = # have to copy here to avoid corrupting the original
[
- @{ $attrs->{from} },
- $source->_resolve_join(
- $join, $alias, { %{ $attrs->{seen_join} || {} } }
- )
+ @{ $attrs->{from} },
+ $source->_resolve_join(
+ $join, $alias, { %{ $attrs->{seen_join} || {} } }
+ )
];
-
}
if ( $attrs->{order_by} ) {
$self->throw_exception ('Prefetch with limit (rows/offset) is not supported on resultsets with a custom from attribute')
if (ref $from ne 'ARRAY');
+
# separate attributes
my $sub_attrs = { %$attrs };
delete $attrs->{$_} for qw/where bind rows offset/;
];
}
+ # mangle {from}
+ $from = [ @$from ];
+ my $select_root = shift @$from;
+ my @outer_from = @$from;
- # mangle the head of the {from}
- my $self_ident = shift @$from;
-
+ my %inner_joins;
my %join_info = map { $_->[0]{-alias} => $_->[0] } (@$from);
- my (%inner_joins);
+ # in complex search_related chains $alias may *not* be 'me'
+ # so always include it in the inner join, and also shift away
+ # from the outer stack, so that the two datasets actually do
+ # meet
+ if ($select_root->{-alias} ne $alias) {
+ $inner_joins{$alias} = 1;
+
+ while (@outer_from && $outer_from[0][0]{-alias} ne $alias) {
+ shift @outer_from;
+ }
+ if (! @outer_from) {
+ $self->throw_exception ("Unable to find '$alias' in the {from} stack, something is wrong");
+ }
+
+ shift @outer_from; # the new subquery will represent this alias, so get rid of it
+ }
+
# decide which parts of the join will remain on the inside
#
}
# construct the inner $from for the subquery
- my $inner_from = [ $self_ident ];
- if (keys %inner_joins) {
- for my $j (@$from) {
- push @$inner_from, $j if $inner_joins{$j->[0]{-alias}};
- }
+ my $inner_from = [ $select_root ];
+ for my $j (@$from) {
+ push @$inner_from, $j if $inner_joins{$j->[0]{-alias}};
+ }
- # if a multi-type join was needed in the subquery ("multi" is indicated by
- # presence in {collapse}) - add a group_by to simulate the collapse in the subq
- for my $alias (keys %inner_joins) {
+ # if a multi-type join was needed in the subquery ("multi" is indicated by
+ # presence in {collapse}) - add a group_by to simulate the collapse in the subq
- # the dot comes from some weirdness in collapse
- # remove after the rewrite
- if ($attrs->{collapse}{".$alias"}) {
- $sub_attrs->{group_by} = $sub_select;
- last;
- }
+ for my $alias (keys %inner_joins) {
+
+ # the dot comes from some weirdness in collapse
+ # remove after the rewrite
+ if ($attrs->{collapse}{".$alias"}) {
+ $sub_attrs->{group_by} = $sub_select;
+ last;
}
}
$sub_attrs
);
- # put it back in $from
- unshift @$from, { $alias => $subq };
+ # put it in the new {from}
+ unshift @outer_from, { $alias => $subq };
# This is totally horrific - the $where ends up in both the inner and outer query
# Unfortunately not much can be done until SQLA2 introspection arrives
#
# OTOH it can be seen as a plus: <ash> (notes that this query would make a DBA cry ;)
- return ($from, $select, $where, $attrs);
+ return (\@outer_from, $select, $where, $attrs);
}
sub _resolve_ident_sources {
return $alias2source;
}
-sub count {
- my ($self, $source, $attrs) = @_;
-
- my $tmp_attrs = { %$attrs };
-
- # take off any limits, record_filter is cdbi, and no point of ordering a count
- delete $tmp_attrs->{$_} for (qw/select as rows offset order_by record_filter/);
-
- # overwrite the selector
- $tmp_attrs->{select} = { count => '*' };
-
- my $tmp_rs = $source->resultset_class->new($source, $tmp_attrs);
- my ($count) = $tmp_rs->cursor->next;
-
- # if the offset/rows attributes are still present, we did not use
- # a subquery, so we need to make the calculations in software
- $count -= $attrs->{offset} if $attrs->{offset};
- $count = $attrs->{rows} if $attrs->{rows} and $attrs->{rows} < $count;
- $count = 0 if ($count < 0);
-
- return $count;
-}
-
-sub count_grouped {
- my ($self, $source, $attrs) = @_;
-
- # copy for the subquery, we need to do some adjustments to it too
- my $sub_attrs = { %$attrs };
-
- # these can not go in the subquery, and there is no point of ordering it
- delete $sub_attrs->{$_} for qw/collapse select as order_by/;
-
- # if we prefetch, we group_by primary keys only as this is what we would get out of the rs via ->next/->all
- # simply deleting group_by suffices, as the code below will re-fill it
- # Note: we check $attrs, as $sub_attrs has collapse deleted
- if (ref $attrs->{collapse} and keys %{$attrs->{collapse}} ) {
- delete $sub_attrs->{group_by};
- }
-
- $sub_attrs->{group_by} ||= [ map { "$attrs->{alias}.$_" } ($source->primary_columns) ];
- $sub_attrs->{select} = $self->_grouped_count_select ($source, $sub_attrs);
-
- $attrs->{from} = [{
- count_subq => $source->resultset_class->new ($source, $sub_attrs )->as_query
- }];
-
- # the subquery replaces this
- delete $attrs->{$_} for qw/where bind collapse group_by having having_bind rows offset/;
-
- return $self->count ($source, $attrs);
+# Returns a counting SELECT for a simple count
+# query. Abstracted so that a storage could override
+# this to { count => 'firstcol' } or whatever makes
+# sense as a performance optimization
+sub _count_select {
+ #my ($self, $source, $rs_attrs) = @_;
+ return { count => '*' };
}
+# Returns a SELECT which will end up in the subselect
+# There may or may not be a group_by, as the subquery
+# might have been called to accomodate a limit
#
-# Returns a SELECT to go with a supplied GROUP BY
-# (caled by count_grouped so a group_by is present)
-# Most databases expect them to match, but some
-# choke in various ways.
+# Most databases would be happy with whatever ends up
+# here, but some choke in various ways.
#
-sub _grouped_count_select {
- my ($self, $source, $rs_args) = @_;
- return $rs_args->{group_by};
+sub _subq_count_select {
+ my ($self, $source, $rs_attrs) = @_;
+ return $rs_attrs->{group_by} if $rs_attrs->{group_by};
+
+ my @pcols = map { join '.', $rs_attrs->{alias}, $_ } ($source->primary_columns);
+ return @pcols ? \@pcols : [ 1 ];
}
+
sub source_bind_attributes {
my ($self, $source) = @_;
-
+
my $bind_attributes;
foreach my $column ($source->columns) {
-
+
my $data_type = $source->column_info($column)->{data_type} || '';
$bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
if $data_type;
# primary keys of the main table in the inner query. This hopefully still
# hits the indexes and keeps mysql happy.
# (mysql does not care if the SELECT and the GROUP BY match)
-sub _grouped_count_select {
- my ($self, $source, $rs_args) = @_;
- my @pcols = map { join '.', $rs_args->{alias}, $_ } ($source->primary_columns);
- return @pcols ? \@pcols : $rs_args->{group_by};
+sub _subq_count_select {
+ my ($self, $source, $rs_attrs) = @_;
+ my @pcols = map { join '.', $rs_attrs->{alias}, $_ } ($source->primary_columns);
+ return @pcols ? \@pcols : [ 1 ];
}
1;
--- /dev/null
+use strict;
+use warnings;
+
+use lib qw(t/lib);
+
+use Test::More;
+use DBICTest;
+use DBIC::SqlMakerTest;
+use DBIC::DebugObj;
+
+plan tests => 10;
+
+my $schema = DBICTest->init_schema();
+
+# non-collapsing prefetch (no multi prefetches)
+{
+ my $rs = $schema->resultset("CD")
+ ->search_related('tracks',
+ { position => [1,2] },
+ { prefetch => [qw/disc lyrics/], rows => 3, offset => 8 },
+ );
+ is ($rs->all, 2, 'Correct number of objects');
+
+
+ my ($sql, @bind);
+ $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+ $schema->storage->debug(1);
+
+ is ($rs->count, 2, 'Correct count via count()');
+
+ is_same_sql_bind (
+ $sql,
+ \@bind,
+ 'SELECT COUNT( * )
+ FROM cd me
+ LEFT JOIN track tracks ON tracks.cd = me.cdid
+ JOIN cd disc ON disc.cdid = tracks.cd
+ LEFT JOIN lyrics lyrics ON lyrics.track_id = tracks.trackid
+ WHERE ( ( position = ? OR position = ? ) )
+ ',
+ [ qw/'1' '2'/ ],
+ 'count softlimit applied',
+ );
+
+ my $crs = $rs->count_rs;
+ is ($crs->next, 2, 'Correct count via count_rs()');
+
+ is_same_sql_bind (
+ $crs->as_query,
+ '(SELECT COUNT( * )
+ FROM (
+ SELECT tracks.trackid
+ FROM cd me
+ LEFT JOIN track tracks ON tracks.cd = me.cdid
+ JOIN cd disc ON disc.cdid = tracks.cd
+ LEFT JOIN lyrics lyrics ON lyrics.track_id = tracks.trackid
+ WHERE ( ( position = ? OR position = ? ) )
+ LIMIT 3 OFFSET 8
+ ) count_subq
+ )',
+ [ [ position => 1 ], [ position => 2 ] ],
+ 'count_rs db-side limit applied',
+ );
+}
+
+# has_many prefetch with limit
+{
+ my $rs = $schema->resultset("Artist")
+ ->search_related('cds',
+ { 'tracks.position' => [1,2] },
+ { prefetch => [qw/tracks artist/], rows => 3, offset => 4 },
+ );
+ is ($rs->all, 1, 'Correct number of objects');
+
+ my ($sql, @bind);
+ $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+ $schema->storage->debug(1);
+
+ is ($rs->count, 1, 'Correct count via count()');
+
+ is_same_sql_bind (
+ $sql,
+ \@bind,
+ 'SELECT COUNT( * )
+ FROM (
+ SELECT cds.cdid
+ FROM artist me
+ LEFT JOIN cd cds ON cds.artist = me.artistid
+ LEFT JOIN track tracks ON tracks.cd = cds.cdid
+ JOIN artist artist ON artist.artistid = cds.artist
+ WHERE tracks.position = ? OR tracks.position = ?
+ GROUP BY cds.cdid
+ ) count_subq
+ ',
+ [ qw/'1' '2'/ ],
+ 'count softlimit applied',
+ );
+
+ my $crs = $rs->count_rs;
+ is ($crs->next, 1, 'Correct count via count_rs()');
+
+ is_same_sql_bind (
+ $crs->as_query,
+ '(SELECT COUNT( * )
+ FROM (
+ SELECT cds.cdid
+ FROM artist me
+ LEFT JOIN cd cds ON cds.artist = me.artistid
+ LEFT JOIN track tracks ON tracks.cd = cds.cdid
+ JOIN artist artist ON artist.artistid = cds.artist
+ WHERE tracks.position = ? OR tracks.position = ?
+ GROUP BY cds.cdid
+ LIMIT 3 OFFSET 4
+ ) count_subq
+ )',
+ [ [ 'tracks.position' => 1 ], [ 'tracks.position' => 2 ] ],
+ 'count_rs db-side limit applied',
+ );
+}
my $schema = DBICTest->init_schema();
-eval "use DBD::SQLite";
-plan skip_all => 'needs DBD::SQLite for testing' if $@;
-plan tests => 22;
+plan tests => 58;
# The tag Blue is assigned to cds 1 2 3 and 5
# The tag Cheesy is assigned to cds 2 4 and 5
my $rs;
my $in_rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] });
-$rs = $schema->resultset('Tag')->search({ tag => 'Blue' });
-is($rs->count, 4, 'Count without DISTINCT');
+for my $get_count (
+ sub { shift->count },
+ sub { my $crs = shift->count_rs; isa_ok ($crs, 'DBIx::Class::ResultSetColumn'); $crs->next }
+) {
+ $rs = $schema->resultset('Tag')->search({ tag => 'Blue' });
+ is($get_count->($rs), 4, 'Count without DISTINCT');
-$rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'tag' });
-is($rs->count, 2, 'Count with single column group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'tag' });
+ is($get_count->($rs), 2, 'Count with single column group_by');
-$rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'cd' });
-is($rs->count, 5, 'Count with another single column group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'cd' });
+ is($get_count->($rs), 5, 'Count with another single column group_by');
-$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { group_by => [ qw/tag cd/ ]});
-is($rs->count, 4, 'Count with multiple column group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { group_by => [ qw/tag cd/ ]});
+ is($get_count->($rs), 4, 'Count with multiple column group_by');
-$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { distinct => 1 });
-is($rs->count, 4, 'Count with single column distinct');
+ $rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { distinct => 1 });
+ is($get_count->($rs), 4, 'Count with single column distinct');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } });
-is($rs->count, 7, 'Count with IN subquery');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } });
+ is($get_count->($rs), 7, 'Count with IN subquery');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { group_by => 'tag' });
-is($rs->count, 2, 'Count with IN subquery with outside group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { group_by => 'tag' });
+ is($get_count->($rs), 2, 'Count with IN subquery with outside group_by');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1 });
-is($rs->count, 7, 'Count with IN subquery with outside distinct');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1 });
+ is($get_count->($rs), 7, 'Count with IN subquery with outside distinct');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1, select => 'tag' }),
-is($rs->count, 2, 'Count with IN subquery with outside distinct on a single column');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1, select => 'tag' }),
+ is($get_count->($rs), 2, 'Count with IN subquery with outside distinct on a single column');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'tag' })->get_column('tag')->as_query } });
-is($rs->count, 7, 'Count with IN subquery with single group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'tag' })->get_column('tag')->as_query } });
+ is($get_count->($rs), 7, 'Count with IN subquery with single group_by');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'cd' })->get_column('tag')->as_query } });
-is($rs->count, 7, 'Count with IN subquery with another single group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'cd' })->get_column('tag')->as_query } });
+ is($get_count->($rs), 7, 'Count with IN subquery with another single group_by');
-$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => [ qw/tag cd/ ] })->get_column('tag')->as_query } });
-is($rs->count, 7, 'Count with IN subquery with multiple group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => [ qw/tag cd/ ] })->get_column('tag')->as_query } });
+ is($get_count->($rs), 7, 'Count with IN subquery with multiple group_by');
-$rs = $schema->resultset('Tag')->search({ tag => \"= 'Blue'" });
-is($rs->count, 4, 'Count without DISTINCT, using literal SQL');
+ $rs = $schema->resultset('Tag')->search({ tag => \"= 'Blue'" });
+ is($get_count->($rs), 4, 'Count without DISTINCT, using literal SQL');
-$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'tag' });
-is($rs->count, 2, 'Count with literal SQL and single group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'tag' });
+ is($get_count->($rs), 2, 'Count with literal SQL and single group_by');
-$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'cd' });
-is($rs->count, 5, 'Count with literal SQL and another single group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'cd' });
+ is($get_count->($rs), 5, 'Count with literal SQL and another single group_by');
-$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => [ qw/tag cd/ ] });
-is($rs->count, 7, 'Count with literal SQL and multiple group_by');
+ $rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => [ qw/tag cd/ ] });
+ is($get_count->($rs), 7, 'Count with literal SQL and multiple group_by');
-$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { '+select' => { max => 'tagid' }, distinct => 1 });
-is($rs->count, 4, 'Count with +select aggreggate');
+ $rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { '+select' => { max => 'tagid' }, distinct => 1 });
+ is($get_count->($rs), 4, 'Count with +select aggreggate');
-$rs = $schema->resultset('Tag')->search({}, { select => 'length(me.tag)', distinct => 1 });
-is($rs->count, 3, 'Count by distinct function result as select literal');
+ $rs = $schema->resultset('Tag')->search({}, { select => 'length(me.tag)', distinct => 1 });
+ is($get_count->($rs), 3, 'Count by distinct function result as select literal');
+}
eval {
my @warnings;
throws_ok(
sub { my $row = $schema->resultset('Tag')->search({}, { select => { distinct => [qw/tag cd/] } })->first },
- qr/select => { distinct => ... } syntax is not supported for multiple columns/,
+ qr/select => { distinct => \.\.\. } syntax is not supported for multiple columns/,
'throw on unsupported syntax'
);