Skip Menu |

This queue is for tickets about the Class-DBI-Sweet CPAN distribution.

Report information
The Basics
Id: 16481
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Class-DBI-Sweet

People
Owner: PHRED [...] cpan.org
Requestors: cdbi-sweet [...] bereft.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



Subject: g modifier missing on s///e
Hi, When I have search criteria like: { rectype => undef, errors.name => undef } Where the error table also has a rectype column I get an error !! ERROR: 1 'ambiguous column name: rectype(1) at dbdimp.c line 268' (err#0) T <- prepare_cached('SELECT me.id FROM line me, error errors WHERE ( errors.name IS NULL AND rectype IS NULL ) AND me.id = errors.line ORDER BY me.id LIMIT ? OFFSET ? ')= undef at DBI.pm line 391 It seems to be because only the first IS NOT NULL has the column aliased correctly by the s///: $sql =~ s/(\S+)( IS(?: NOT)? NULL)/$self->_default_tables($1).$2/e; It should be s///ge to replace them all. I'm using 0.05 but the bug is still present in 0.07
--- /usr/local/share/perl/5.8.4/Class/DBI/Sweet.pm 2005-12-14 11:53:27.947233896 +0100 +++ /home/bsb/Sweet.pm 2005-12-14 11:53:39.211521464 +0100 @@ -633,7 +633,7 @@ $sql .= $self->_sqlcase(' where ') . $wh if $wh; } - $sql =~ s/(\S+)( IS(?: NOT)? NULL)/$self->_default_tables($1).$2/e; + $sql =~ s/(\S+)( IS(?: NOT)? NULL)/$self->_default_tables($1).$2/ge; my $joins = delete $self->{cdbi_join_info}; my $tables = delete $self->{cdbi_table_aliases};
This fix is present in version 0.08, thanks for the report.