[ic] Form and set, database access

Kevin Walsh interchange-users@icdevgroup.org
Tue Jul 9 01:59:00 2002


> can somebody say me why this code:
> 
> [set name="OK"]
>     [flag type=write tables="produits_genres"]
>     [perl tables="produits_genres" global=1]
>     my @genres = split /\0/, $CGI->{genres};
>     my @ids = split /\0/, $CGI->{ids};
>     my $sku = $CGI->{item_id};
>     my $i = 0;
>     my $numelements = scalar (@genres);
>     $Tag->query({sql => "delete from produits_genres where sku = '$sku'"});
>     while ( $i < $numelements)
>     {
>     $Tag->query({sql => "insert into produits_genres (genre_id,sku) 
> values ('@genres[$i]','$sku')"});
>     $i++;
>     }
>     return;
>     [/perl]
> [/set]
> 
> write this error in the error.log:
> 127.0.0.1 TEg2rbzU:127.0.0.1 - [08/juillet/2002:19:31:42 +0200] 
> sexycatalogue /cgi-bin/sexycatalogue/process.html Safe: no access for 
> database products at /usr/lib/interchange/lib/Vend/Data.pm line 906.
>
You need to specify the 'table' attribute when calling the query tag
unless your query acts on the products table.  In fact, just set it
anyway:

    $Tag->query({
        table => 'produits_genres',
        sql => qq{
            DELETE
            FROM    produits_genres
            WHERE   sku = '$sku'
        },
    });

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/