On Fri, Jun 25, 2010 at 02:16:41PM +0200, Laslo Forro scratched on the wall:
> Hi there, I am trying to make a trigger calling a function BEFORE DELETE on
> a table that contains file names. This function takes the filename of the
> row to be deleted, removes it and returns undef on failure.
> I am not too expert of triggers and it can be solved from a script, but that
> is not a nice design.
> 
> Here is my trigger attempt:
> 
> CREATE TABLE table1 (  a text, b text );
> 
> CREATE TRIGGER recall_who BEFORE DELETE ON table1 FOR EACH ROW
> WHEN NOT recall_delete( table1.a )
>   BEGIN
>   SELECT RAISE (IGNORE);
>   END;
> 
> func. remove_file takes one argument, the col.a value of table1; containing
> the full path of the file.
> However, I receive this error on the populated table:
> 
> DBD::SQLite::db do failed: no such column: table1.a at SQLiteTrigger.plx
> line 35.
> 
> I would think that I have referred to the table properly...

  Try "OLD.a".

  http://www.sqlite.org/lang_createtrigger.html

    -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to