Olaf Beckman Lapré wrote:
Is it possible to get a callback when doing an INSERT on a table similar to a SELECT callback? The callback would then contain the same parameters but only contain the row(s) being inserted.
The reason I'm asking is that this may be usefull in GUI applications where you
insert table rows into a listcontrol. Instead of emptying the listcontrol and
using the SELECT callback to fill it again, one could simply add the row being
added from the INSERT callback.
Olaf
Olaf,
You can do this by adding an insert trigger to your table and
registering a user function that will call back to your code.
create trigger t_in after insert on t
begin
select do_insert_callback(new.rowid);
end;
You will have to write and register the user defined function
do_insert_callback(). It should pass the new record's rowid value back
to you main application which can then use it to retrieve the record for
addition to your display list.
See section 2.3 User Defined function at
http://www.sqlite.org/capi3.html for additional information on creating
a user defined function.
HTH
Dennis Cote