comparison MySQL/Plugins/GetLastChangeIndex.sql @ 87:48d445f756db db-changes

new extension implemented for MySQL: GetLastChangeIndex
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jan 2019 20:39:36 +0100
parents
children 740d9829f52e
comparison
equal deleted inserted replaced
86:d16e94157efe 87:48d445f756db
1 CREATE TABLE GlobalIntegers(
2 property INTEGER PRIMARY KEY,
3 value BIGINT
4 );
5
6
7 INSERT INTO GlobalIntegers
8 SELECT 0, COALESCE(MAX(seq), 0) FROM Changes;
9
10
11 CREATE TRIGGER ChangeAdded
12 AFTER INSERT ON Changes
13 FOR EACH ROW
14 BEGIN
15 UPDATE GlobalIntegers SET value = new.seq WHERE property = 0@
16 END;