<bdo id='QcAi8'></bdo><ul id='QcAi8'></ul>

  • <tfoot id='QcAi8'></tfoot>

    <small id='QcAi8'></small><noframes id='QcAi8'>

    <legend id='QcAi8'><style id='QcAi8'><dir id='QcAi8'><q id='QcAi8'></q></dir></style></legend>

      1. <i id='QcAi8'><tr id='QcAi8'><dt id='QcAi8'><q id='QcAi8'><span id='QcAi8'><b id='QcAi8'><form id='QcAi8'><ins id='QcAi8'></ins><ul id='QcAi8'></ul><sub id='QcAi8'></sub></form><legend id='QcAi8'></legend><bdo id='QcAi8'><pre id='QcAi8'><center id='QcAi8'></center></pre></bdo></b><th id='QcAi8'></th></span></q></dt></tr></i><div id='QcAi8'><tfoot id='QcAi8'></tfoot><dl id='QcAi8'><fieldset id='QcAi8'></fieldset></dl></div>
      2. 插入表后在mysql触发器中发送http请求

        时间:2023-07-15
        <i id='dgEAL'><tr id='dgEAL'><dt id='dgEAL'><q id='dgEAL'><span id='dgEAL'><b id='dgEAL'><form id='dgEAL'><ins id='dgEAL'></ins><ul id='dgEAL'></ul><sub id='dgEAL'></sub></form><legend id='dgEAL'></legend><bdo id='dgEAL'><pre id='dgEAL'><center id='dgEAL'></center></pre></bdo></b><th id='dgEAL'></th></span></q></dt></tr></i><div id='dgEAL'><tfoot id='dgEAL'></tfoot><dl id='dgEAL'><fieldset id='dgEAL'></fieldset></dl></div>

              <tbody id='dgEAL'></tbody>

              • <bdo id='dgEAL'></bdo><ul id='dgEAL'></ul>
              • <legend id='dgEAL'><style id='dgEAL'><dir id='dgEAL'><q id='dgEAL'></q></dir></style></legend>

                <small id='dgEAL'></small><noframes id='dgEAL'>

                1. <tfoot id='dgEAL'></tfoot>
                2. 本文介绍了插入表后在mysql触发器中发送http请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 PHP 中工作.我必须创建一个 mysql 触发器,它会在插入表后触发 http 请求.下面是代码.

                  I am working in PHP.I have to created a mysql trigger which fires an http request after insertion on table.Below is the code.

                  DELIMITER @@
                  CREATE TRIGGER Test_Trigger
                  AFTER INSERT ON insertsms
                  FOR EACH ROW
                  BEGIN
                    SET @tt_json = (SELECT json_object(id,addtime,title) 
                                    FROM insertsms WHERE id = NEW.id LIMIT 1);
                    SET @tt_resu = (SELECT http_put(CONCAT('--url localhost--')));
                  END;
                  @@
                  DELIMITER ;
                  

                  但我收到类似的错误

                  消息:SQLSTATE[42000]:语法错误或访问冲突:1305 FUNCTION emg.json_object 不存在

                  Message: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION emg.json_object does not exist

                  消息:SQLSTATE[42000]:语法错误或访问冲突:1305 FUNCTION emg.http_put 不存在

                  Message: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION emg.http_put does not exist

                  如何消除这个错误?我无法下载包含这些功能的支持文件.我已经在 localhost 中进行了测试.还有其他方法可以满足我的要求吗?请任何人帮助我..

                  How to remove this error? I was not able to download the supporting files containing these functions.I have tested in localhost.Is there any other way to achieve my requirement? Please anyone help me..

                  推荐答案

                  虽然技术上可行,但出于以下几个原因,我强烈建议您不要走这条路:

                  Although it's technically possible I'd strongly discourage you from going this route for several reasons:

                  1. 使用 UDF 本身就是一种安全风险.UDF 可供所有数据库用户使用 - 您不能为其授予 EXECUTE 权限.

                  1. Using UDFs is a security risk on its own. UDFs are available to all database users - you cannot grant EXECUTE privileges for them.

                  在触发器中执行任何非事务性操作完全是错误的.DML 语句所做的数据更改(在您的情况下是更新)可以并且将在现实世界中回滚.您将无法撤消 http 调用.

                  Doing any non-transactional operations in a trigger is simply wrong. Data changes made by DML statement (in your case it's an update) can and will be rolled back in a real world scenario. You won't be able to undo your http calls.

                  您延长了插入事务的时间,可能会导致其他更新/插入操作的锁定等待超时.

                  You're prolonging the time for insert transaction possibly causing lock-wait-timeouts for other update/insert operations.

                  强烈推荐阅读:

                  • 触发器的问题

                  现在很可能你需要的是一个工作队列,例如beanstalked.使用这种专门的中间件比用数据库组织队列要好得多.

                  Now most likely what you need is a work queue e.g. beanstalked. Using such specialized middleware is much better than organizing queues with database.

                  这篇关于插入表后在mysql触发器中发送http请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 将用户 ID 传递给 mysql 触发器 下一篇:在 PHP 中将纯文本 URL 转换为 HTML 超链接

                  相关文章

                    <bdo id='SuO0c'></bdo><ul id='SuO0c'></ul>

                      <i id='SuO0c'><tr id='SuO0c'><dt id='SuO0c'><q id='SuO0c'><span id='SuO0c'><b id='SuO0c'><form id='SuO0c'><ins id='SuO0c'></ins><ul id='SuO0c'></ul><sub id='SuO0c'></sub></form><legend id='SuO0c'></legend><bdo id='SuO0c'><pre id='SuO0c'><center id='SuO0c'></center></pre></bdo></b><th id='SuO0c'></th></span></q></dt></tr></i><div id='SuO0c'><tfoot id='SuO0c'></tfoot><dl id='SuO0c'><fieldset id='SuO0c'></fieldset></dl></div>
                      <legend id='SuO0c'><style id='SuO0c'><dir id='SuO0c'><q id='SuO0c'></q></dir></style></legend>
                    1. <small id='SuO0c'></small><noframes id='SuO0c'>

                    2. <tfoot id='SuO0c'></tfoot>