简体   繁体   中英

execute stored procedure automatically when a select query want run in mysql

I have a application that connected to my database and execute query on it.
Also I have a stored procedure.
Now I want every time that application try to execute a query on my database, my procedure run and effect (change) results of application query.

Is it possible? And how?

note that my database is mysql and I can not modify the application code.

You might want to take a look into triggers:

http://dev.mysql.com/doc/refman/5.0/en/triggers.html

-- update --

I can think of a different possibility. It's ugly:

You could hide your table behind a view by renaming the table and creating a view with it's original name, then manipulate the data in the select statement of the view. You just have to be sure the view returns the column names the original query did.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM