product$storestaus.sql 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. -- ----------------------------
  2. -- Triggers structure for table product$storestaus
  3. -- ----------------------------
  4. DROP TRIGGER IF EXISTS `sync$product_storestaus_i`;
  5. delimiter ;;
  6. CREATE DEFINER = `root`@`%` TRIGGER `sync$product_storestaus_i` AFTER INSERT ON `product$storestaus` FOR EACH ROW begin
  7. declare v_table_name varchar(64) default 'product$storestaus';
  8. declare v_method_type varchar(6) default 'insert';
  9. declare v_data_key text;
  10. declare v_data text;
  11. declare v_priority int default 1;
  12. set v_data_key=concat('{"pr_id": ', new.pr_id, '}');
  13. select concat(
  14. concat('{'),
  15. -- varchar
  16. -- bit(1), smallint(6), int(11), bigint(20), double
  17. concat('"pr_enuu": ', case when new.pr_enuu is null then 'null' else new.pr_enuu end),
  18. concat(',"pr_status": ', case when new.pr_status is null then 'null' else new.pr_status end),
  19. concat(',"pr_useruu": ', case when new.pr_useruu is null then 'null' else new.pr_useruu end),
  20. -- datetime
  21. concat(',"pr_date": ', case when new.pr_date is null then 'null' else concat('"', replace(new.pr_date, '"', '\\"'), '"') end),
  22. -- text
  23. -- json
  24. concat('}')
  25. ) into v_data;
  26. call sync$enqueue_message(v_table_name, v_method_type, v_data_key, v_data, v_priority);
  27. end
  28. ;;
  29. delimiter ;
  30. -- ----------------------------
  31. -- Triggers structure for table product$storestaus
  32. -- ----------------------------
  33. DROP TRIGGER IF EXISTS `sync$product_storestaus_u`;
  34. delimiter ;;
  35. CREATE DEFINER = `root`@`%` TRIGGER `sync$product_storestaus_u` AFTER UPDATE ON `product$storestaus` FOR EACH ROW begin
  36. declare v_table_name varchar(64) default 'product$storestaus';
  37. declare v_method_type varchar(6) default 'update';
  38. declare v_data_key text;
  39. declare v_data text;
  40. declare v_priority int default 1;
  41. set v_data_key=concat('{"pr_id": ', old.pr_id, '}');
  42. select concat(
  43. concat('{'),
  44. -- varchar
  45. -- bit(1), smallint(6), int(11), bigint(20), double
  46. concat('"pr_enuu": ', case when new.pr_enuu is null then 'null' else new.pr_enuu end),
  47. concat(',"pr_status": ', case when new.pr_status is null then 'null' else new.pr_status end),
  48. concat(',"pr_useruu": ', case when new.pr_useruu is null then 'null' else new.pr_useruu end),
  49. -- datetime
  50. concat(',"pr_date": ', case when new.pr_date is null then 'null' else concat('"', replace(new.pr_date, '"', '\\"'), '"') end),
  51. -- text
  52. -- json
  53. concat('}')
  54. ) into v_data;
  55. call sync$enqueue_message(v_table_name, v_method_type, v_data_key, v_data, v_priority);
  56. end
  57. ;;
  58. delimiter ;
  59. -- ----------------------------
  60. -- Triggers structure for table product$storestaus
  61. -- ----------------------------
  62. DROP TRIGGER IF EXISTS `sync$product_storestaus_d`;
  63. delimiter ;;
  64. CREATE DEFINER = `root`@`%` TRIGGER `sync$product_storestaus_d` AFTER DELETE ON `product$storestaus` FOR EACH ROW begin
  65. declare v_table_name varchar(64) default 'product$storestaus';
  66. declare v_method_type varchar(6) default 'delete';
  67. declare v_data_key text;
  68. declare v_data text;
  69. declare v_priority int default 1;
  70. set v_data_key=concat('{"pr_id": ', old.pr_id, '}');
  71. call sync$enqueue_message(v_table_name, v_method_type, v_data_key, v_data, v_priority);
  72. end
  73. ;;
  74. delimiter ;