On 09/02/06, Rich Shepard <[EMAIL PROTECTED]> wrote:
> self.cur.execute("CREATE TRIGGER fki_comp_cat BEFORE INSERT ON component
> FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "category"
> violates foreign key constraint "fk_comp_cat"') WHERE NEW.comp_cat IS NOT
> NULL AND (SELECT cat_name FROM category WHERE cat_name = NEW.comp_cat) IS
> NULL END")
> ^
> SyntaxError: invalid syntax
At a guess, the error here is that the double-quote before CREATE is
matching the double quote before 'category', finishing the string
there.
A triple-quoted string should work for you because lone single or
double quotes in a triple-quoted string are passed literally.
Otherwise, you need to escape them --- ie: 'insert on table
\"category\" ...'.
HTH!
--
John.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor