[Koha-devel] $query vs $query

Joe Atzberger ohiocore at gmail.com
Thu Jul 9 19:13:49 CEST 2009


3) Both are valid.

For the most part, SQL should be in C4 modules, and only .pl scripts should
have CGI objects.

I am fine with 2a, using $cgi as a variable name, too, but I wouldn't spend
much time on this.

-- 
Joe Atzberger
LibLime - Open Source Library Solutions

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
>  <http://lists.koha.org/mailman/listinfo/koha-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20090709/8f950de4/attachment-0003.htm>


More information about the Koha-devel mailing list