Hi everyone,

My C program has a CREATE TRIGGER statement which contains a template "?":

CREATE TABLE employees (
  employee_id INTEGER PRIMARY KEY,
  dep_id TINYINT,
  score FLOAT
);
CREATE TRIGGER on_ins_employee AFTER 
INSERT ON employees 
WHEN ? < (SELECT count(1) FROM employees WHERE dep_id == NEW.dep_id)
BEGIN 
DELETE FROM employees 
WHERE score == (SELECT min(score) FROM employees WHERE dep_id == NEW.dep_id);
END;

I intended to use sqlite3_bind_int() to bind the maximal number of employees a 
department can contain to the template. The C program works without error. 
However, the trigger does not work when I insert into the employees table.

I used the latest sqlite-3.7.2. Is this a bug of SQLite? Or did I misused the C 
API?

Thanks.



        Zhixiang Zhu 
        zzxiang2...@hotmail.com 
          2010-09-08 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to