MySQL回调 - 有没有这样的事情? [英] MySQL callback - is there such a thing?

查看:145
本文介绍了MySQL回调 - 有没有这样的事情?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在INSERT或UPDATE之后是否存在类似于回调函数使用mysql的回调函数,它可以返回行#和这些行的值。

I was wondering if there's such thing as the equivalent as a callback function using mysql after an INSERT or UPDATE which could return me the row # and maybe values of such rows.

推荐答案

我不知道任何回调,你说,但肯定从你的调用应用程序,你可以检索最后插入的ID,如果你没有指定它,并且db生成了一个自动增量值。您应该已经知道的其他值,因为您已经插入它们。

I am not aware of any callback as you say but surely from your calling application you can retrieve the last inserted ID in case you did not specify it and the db has generated an auto increment value. Other values you should already know because you have inserted them.

如果您需要知道数据库服务器中的这些值,您可以有一个SQL触发器,插入,因此您可以对新插入的记录进行更多处理,例如在另一个表中写入内容等...

if you need to know those values within the database server, you can have a SQL trigger which is executed at every insert so you can do more processing on the newly inserted record, for example write something in another table etc...

这篇关于MySQL回调 - 有没有这样的事情?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆