[Koha-devel] DBIx query or
Fridolin SOMERS
fridolin.somers at biblibre.com
Thu Nov 5 12:14:23 CET 2020
Ahhhh OK thanks a lot for the explanation ;)
Le 03/11/2020 à 11:30, Jonathan Druart a écrit :
> Hi Frido,
>
> On 26407 we must use an arrayref as we searched on the same attribute,
> but otherwise both syntax are identical.
>
> Koha::Patrons->search({ -or => { surname => 'koha', firstname => 'koha' } })
> Koha::Patrons->search({ -or => [ surname => 'koha', firstname => 'koha' ] })
> Koha::Patrons->search([ surname => 'koha', firstname => 'koha' ])
> Will generate the same query.
>
> Same for:
> Koha::Patrons->search({ -and => { surname => 'koha', firstname => 'koha'
> } })
> Koha::Patrons->search({ -and => [ surname => 'koha', firstname => 'koha'
> ] })
> Koha::Patrons->search({ surname => 'koha', firstname => 'koha' })
>
> See also https://metacpan.org/pod/SQL::Abstract::Classic#WHERE-CLAUSES
> <https://metacpan.org/pod/SQL::Abstract::Classic#WHERE-CLAUSES>
>
> Cheers,
> Jonathan
>
>
> Le mar. 3 nov. 2020 à 09:02, Fridolin SOMERS
> <fridolin.somers at biblibre.com <mailto:fridolin.somers at biblibre.com>> a
> écrit :
>
> Hi,
>
> I recently changed a call on Koha::Biblios->search() to use an arrayref
> instead of hashref :
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26407
> <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26407>
>
> But I see there are both arrayref of hashref existing in code for "-or"
> query.
>
> What is the difference ?
> Is there a way we should choose in guidelines ?
>
> Best regards,
>
> --
> Fridolin SOMERS <fridolin.somers at biblibre.com
> <mailto:fridolin.somers at biblibre.com>>
> Software and system maintainer 🦄
> BibLibre, France
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> <mailto:Koha-devel at lists.koha-community.org>
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel>
> website : http://www.koha-community.org/
> <http://www.koha-community.org/>
> git : http://git.koha-community.org/ <http://git.koha-community.org/>
> bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>
>
--
Fridolin SOMERS <fridolin.somers at biblibre.com>
Software and system maintainer 🦄
BibLibre, France
More information about the Koha-devel
mailing list