Bug 7785: remove MySQL-specific syntax from C4::Members::columns()
authorMark Tompsett <mtompset@hotmail.com>
Sun, 30 Jun 2013 00:46:51 +0000 (20:46 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 13 Aug 2013 16:14:35 +0000 (16:14 +0000)
commit07716ca15bdc8164dcbc6d70fa1e3f5b8bffcff3
treed1d7b377a12a56fd90664667ab2b9bf2af9aa34e
parent5868490f026d0632416fdb78a6c0e7047f1e0df5
Bug 7785: remove MySQL-specific syntax from C4::Members::columns()

The initial thought was to remove this function. However,
tools/import_borrowers.pl uses it. So rather than remove
it to solve the problem, it was reworked to a more generic
solution which runs faster.

By accessing $sth->{NAME} directly, the driver becomes
responsible for filling it correctly. This happens when a SELECT
is done on the borrowers table. It does not even have to have
data in the result set!

The columns method could be more generic and used elsewhere too.
Comparison between the old method and the STH method showed a
significant time difference. The old method took 35 seconds
for 40k iterations versus 19 seconds for the same amount of
iterations with the STH method regardless of the size of the
borrowers table.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Members.pm
t/db_dependent/Members_columns.t [new file with mode: 0644]