[Koha-devel] $query vs $query

Kyle Hall kyle.m.hall at gmail.com
Thu Jul 9 19:06:58 CEST 2009


I would go with 1b and 2a myself.

Kyle

http://www.kylehall.info
Information Technology
Crawford County Federated Library System ( http://www.ccfls.org )




On Thu, Jul 9, 2009 at 12:16 PM, Marc
Chantreux<marc.chantreux at biblibre.com> wrote:
> hello koha coders,
>
> Koha naming convention drove us to a stupid bug: $query is used both for
> the CGI object and the SQL statements.
>
> So at the end of an hard week, we write :
>
> my $query = CGI->new;
> # lines of code
> $query = "delete * from my_brain";
> # lines of code
> print $query->header;
>
> and try to understand why header is not a function available in the
> weird "delete * from my_brain" package ...
>
> so we would like to change at least one of these convention to prevent
> this easy error. As we are for a stronger coding style in koha, we feel
> that this decision must be debated with all of you.
>
> proposals:
>
> 1. Change the sql statement name
>   a) to $statement
>   b) to $sql
>   c) to $smt
>   d) to an explicit name (as $select_old_borrowers or $update_items ...)
>   e) to your own idea
> 2. Change the CGI object
>   a) to $cgi (i have no idea why ...)
>   b) to $r (as there is a lot of perl code still using this convention)
>   c) to $input (because a part of koha already use it)
>   d) to your own idea
> 3. I don't want to change because *you* did errors ... $query is ok for me!
>
> for myself, i'm fan of 1d *and* 2a ($query is too generic and $input has
> no sense when i write print $input->header).
>
> regards
>
> --
> Marc Chantreux
> BibLibre, expert en logiciels libres pour l'info-doc
> http://biblibre.com
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-devel
>



More information about the Koha-devel mailing list