I've Googled but come up with nothing that I can get my head around.
Are the performance gains from using stored procedures significant?
Would I still want to use prepared statements in conjunction with stored procs or is it generally a one or the other thing?
Can I create stored procs through PHPMyAdmin and manage them from there as well?
What would a stored procedure look like for something simple like this-
SELECT * FROM table a
INNER JOIN otherTable b
ON a.join_id=b.join_id
WHERE someVar = :boundParam
and how would the PHP work (PDO) to call it and bind its parameter?
Create a simple stored procedure. DELIMITER ; To create the MySQL Stored Procedure, open the MySQL workbench Connect to the MySQL Database copy-paste the code in the query editor window click on Execute. You can view the procedure under stored procedures.
A stored procedure is a prepared SQL code that you can save, so the code can be reused over and over again. So if you have an SQL query that you write over and over again, save it as a stored procedure, and then just call it to execute it.
Answer: MySQL has STORED PROCEDURES that are stored as a part of the database/schema like other entities as tables, indexes, etc. These can be created using CREATE PROCEDURE command and can have optional parameters specified to pass data as well as obtain results as a result of procedure execution.
Where are stored procedures stored? Stored procedures are stored in the mysql. routines and mysql. parameters tables, which are part of the data dictionary.
Consider this a gentle introduction to stored procedures in MySQL: http://www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx
You sure can create/manage stored procedures in phpMyAdmin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With