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};