Feature request: extended last_insert_rowid(table_name) function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Feature request: extended last_insert_rowid(table_name) function

Alexey Pechnikov-2
Hello!

With this function the triggers like this

CREATE TRIGGER view_user_insert instead of insert on view_user
begin
  insert into user ...
  insert into user_attribute (user_id,...) values (last_insert_rowid(),...);
  -- user table _must_ have PK column
  insert into user_balance (user_id,...) values ((select max(rowid) from user),...);
...
end;

will be rewrited as

CREATE TRIGGER view_user_insert instead of insert on view_user
begin
  insert into user ...
  insert into user_attribute (user_id,...) values (last_insert_rowid(user),...);
  insert into user_balance (user_id,...) values (last_insert_rowid(user),...);
...
end;

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users