From a43796d5c579ef6a5d85f0b8259cb1bd71468097 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 22 Aug 2017 11:50:50 +0300 Subject: [PATCH] added JSON UPDATE and DELETE tests --- localtests/json57dml/create.sql | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 localtests/json57dml/create.sql diff --git a/localtests/json57dml/create.sql b/localtests/json57dml/create.sql new file mode 100644 index 0000000..2cda51e --- /dev/null +++ b/localtests/json57dml/create.sql @@ -0,0 +1,27 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + updated tinyint not null default 0, + j json, + primary key(id) +) auto_increment=1; + +drop event if exists gh_ost_test; +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test (id, i, j) values (null, 11, '"sometext"'); + insert into gh_ost_test (id, i, j) values (null, 13, '{"key":"val"}'); + insert into gh_ost_test (id, i, j) values (null, 17, '{"is-it": true, "count": 3, "elements": []}'); + + update gh_ost_test set j = '{"updated": 11}', updated = 1 where i = 11 and updated = 0; + update gh_ost_test set j = json_set(j, '$.count', 13), updated = 1 where i = 13 and updated = 0; + delete from gh_ost_test where i = 17; +end ;;