MySQL/phpMyAdmin 从 DELIMITER 冻结

发布于 2024-08-18 15:07:03 字数 375 浏览 2 评论 0原文

运行此过程会导致 MySQL(或 phpMyAdmin)冻结。我必须使用 XAMPP 命令停止 MySQL,该命令在停止前大约 20 秒冻结并且“没有响应”。我相信这是由分隔符命令引起的,它本身就引发了问题。我尝试使用不同的分隔符(“//”),但没有效果。

DELIMITER $

CREATE TRIGGER coroner AFTER INSERT ON events
FOR EACH ROW BEGIN
UPDATE teams WHERE id = NEW.victim SET live = live-1;
UPDATE teams WHERE id = NEW.shooter SET score = score+points;
END

$

DELIMITER ;

Running this procedure causes MySQL (or phpMyAdmin) to freeze. I have to stop MySQL with from XAMPP command, which freezes and "is not responding" about 20 seconds before stopping. I believe this is caused by the delimiter command, which on it's own begins the problems. I have tried using a different delimiter ("//") to no effect.

DELIMITER $

CREATE TRIGGER coroner AFTER INSERT ON events
FOR EACH ROW BEGIN
UPDATE teams WHERE id = NEW.victim SET live = live-1;
UPDATE teams WHERE id = NEW.shooter SET score = score+points;
END

$

DELIMITER ;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

好久不见√ 2024-08-25 15:07:03

事实证明,phpMyAdmin 在 SQL 查询框下方有一个标记为“delimiter:”的字段。使用它而不是命令可以解决问题。进一步的研究表明“DELIMITER”不是一个SQL命令,而是所有SQL ui普遍实现的命令。

As it turns out, phpMyAdmin has a field marked "delimiter:" below the SQL query box. Using it rather than the command solves the problem. Further research explains that "DELIMITER" is not a SQL command, but a command generally implemented by all SQL ui's.

一刻暧昧 2024-08-25 15:07:03

更新命令应该:

update teams set live = live-1 where id = new.victim;
update teams where id = new.shooter set score = score+points;

set 子句之后的 where

the update command should:

update teams set live = live-1 where id = new.victim;
update teams where id = new.shooter set score = score+points;

the where after the set clause

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文