Menu

#5 Browse fails when more than one proper field

open
nobody
Runtime (1)
5
2003-09-24
2003-09-24
No

With this code:
>>>
$dbb = new DBIx::Browse::CGI({
dbh => $dbh,
table => 'lotprice',
proper_fields => [ qw (sellerprice
buyerprice) ],
aliases => [ qw (sellerprice
buyerprice) ],
primary_key => 'lotpriceid',
cgi => $q,
form_params => { mode
=> 'lotprice' },
});
[...]
$dbb->browse({
field_order => [ 0 ],
field_length => [ 14 ]
});
<<<

I get this error in my Apache log:

[Thu Sep 25 01:09:40 2003] [error] [client 127.0.0.1]
[Thu Sep 25 01:09:40 2003] browse_test_pg.pl:
Parameter linked_refs (if present) must have the same
numbers of elements than linked_fields plus one at
D:/Documents and Settings/doshea/My
Documents/Computer/Projects/music/cgi-
bin/browse_test_pg.pl line 22, referer:
http://localhost/music/cgi-bin/browse_test_pg.pl

I see this whenever I have more than one field (or less -
i.e. no fields) in 'proper_fields', but I can have any
number of 'linked_fields' (with the other three
corresponding parameters). When I remove the 'aliases'
parameter the problem goes away.

The issue appears to be in Browse.pm, in init(), on line
153 of revision 2.9 of the file:
>>>
elsif ( scalar(@$lalias) != $n_ltables+1) {
croak $croak_txt->('linked_refs','linked_fields
plus one');
}
<<<

This code appears to be enforcing a restriction that the
number of 'aliases' entries is equal to the number of
linked tables plus one. Note first that $croak_txt is
being passed the wrong parameter name, hence the
error message is complaining about 'linked_refs' instead
of 'aliases'.

I think the key issue is that this restriction should be
ensuring the number of 'aliases' entries is equal to the
number of linked tables plus *the number of 'proper
fields'* (even if the latter is not 1).

Thanks,
David

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.