CC: | Robert Rothenberg <Robert.Rothenberg [...] sciencephoto.com> |
Subject: | Uniqueness checks should use actual column names, not accessors |
Date: | Mon, 20 May 2019 09:35:58 +0100 |
To: | bug-HTML-FormHandler-Model-DBIC [...] rt.cpan.org |
From: | Robert Rothenberg <rrwo [...] cpan.org> |
See https://github.com/gshank/html-formhandler-model-dbic/issues/18 and
PR in https://github.com/gshank/html-formhandler-model-dbic/pull/19
Sometimes a DBIC schema uses an alternative accessor instead of the
actual column name, especially when working with legacy databases, e.g.
__PACKAGE__->add_columns(
"uco" => {
accessor => "username",
data_type => "text",
is_nullable => 0,
original => { data_type => "varchar" },
},
...
);
However, search conditions must use the actual column name, not the
accessor. So the following /will not/ work:
$rs->search( { username => { '!=', $row->username }, ... );
But HFH::Model::DBIIC uses the accessor instead of the actual name