[Koha-bugs] [Bug 5415] New: Simplify Returns from SimpleSearch

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Nov 17 11:50:17 CET 2010


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5415

           Summary: Simplify Returns from SimpleSearch
 Change sponsored?: ---
           Product: Koha
           Version: HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Searching
        AssignedTo: gmcharlt at gmail.com
        ReportedBy: colin.campbell at ptfs-europe.com
         QAContact: koha-bugs at lists.koha-community.org
   Estimated Hours: 0.0


SimpleSearch routine returns an array of three values an errorstring, a
reference to an array of records and a scalar number of hits.

If an error is returned the array_ref and hit_count are undefined

If there is no error returned the errorstring is undefined. but the other
elements maybe defined or undefined.

As a result it exports complexity into the calling interface which typically
has to test is there an error then for each return element test definedness
then assign it etc. leading to code hard to read, maintain and sometimes get
right. People do seem to have a problems resulting from the implied
"randomness" of the return.

Proposal that the variables used in non-error returns are initialized so that
they are only undefined in in error returns. Current code should still work as
is (otherwise its a bit buggy already!) Will mean that only error needs
checking if not defined hit_count is a scalar >= 0 and array_ref is a ref to a
(possibly empty) array.

Calls to SimpleSearch can then simplified accordingly

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the Koha-bugs mailing list