Implement redo by PL/pgSQL
This commit is contained in:
@@ -9,7 +9,7 @@ begin
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- update_title()
|
||||
-- set_title()
|
||||
create function tj.set_title(new_title text) returns void as
|
||||
$$
|
||||
declare
|
||||
|
||||
@@ -84,4 +84,26 @@ declare
|
||||
begin
|
||||
perform tj.execute_undo(true);
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create function tj.redo() returns void as
|
||||
$$
|
||||
declare
|
||||
curr_id int;
|
||||
child_id int;
|
||||
redo_sql text;
|
||||
begin
|
||||
select id into curr_id from tj.current_operation;
|
||||
|
||||
select redo_child into child_id from tj.operation where id = curr_id;
|
||||
if child_id = null then
|
||||
return;
|
||||
end if;
|
||||
|
||||
select redo into redo_sql from tj.operation where id = child_id;
|
||||
|
||||
execute redo_sql;
|
||||
|
||||
update tj.current_operation set id = child_id where id = curr_id;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
@@ -1,3 +1,5 @@
|
||||
drop function if exists tj.redo;
|
||||
|
||||
drop function if exists tj.discard_undo;
|
||||
drop function if exists tj.undo;
|
||||
drop function if exists tj.execute_undo;
|
||||
|
||||
Reference in New Issue
Block a user