On Fri, Jun 15, 2012 at 11:59:33AM +0530, Bageesh.M.Bose wrote:
> Can anyone tell "How to use Triggers in Sqlite using C"
> 

Triggers in SQLite can only contain SQL DML statements. But, you can
interface with C by defining functions, then calling those functions
using SQL SELECT command.

For example:

CREATE TRIGGER mytrigger AFTER INSERT ON mytable
FOR EACH ROW
BEGIN
        SELECT myfunction(NEW.field1, NEW.field2);
END;

where myfunction would be defined using:

        http://sqlite.org/c3ref/create_function.html

However, such usage would result in a database that can only be used
in your application. Using the database in the SQLite shell or some
other application might result in function not found errors if the
trigger is fired.

Hope that helps,
Christian
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to