Wednesday, September 28, 2005

MySQL 5 & stored procedures

hi all,
did you know that the first MySQL 5.0 Release Candidate is Available now ?!!
yes, that's right and you can get it from here.

i have recived the MySQL news letter 2 hours ago and iam so happy to see MySQL in a new style with its new features to be powerful enough to start the long way with Oracle, MS SQL and DB2 .
may we have to wait another 3 years to see MySQL side by side with its competitors .

but let's see the most useful features in that release:
1- stored procedures (i like it so much)
2- triggers
3- views
4- information schema (i was in need of that)
5- Archive storage engine

iam not a databases expert but i know the benefits of using the stored procedures in my applications and i want to thank tarik ibrahim as he was the first one who explained it to me .

in a little words : stored procedures are as same as the normal functions in php or c/c++ but it's stored in the database.
Ex.
CREATE PROCEDURE get_data(IN var1 INTEGER)
BEGIN
IF var1 >= 5 THEN
SELECT * FROM users WHERE id = var1;
ELSE
SELECT * FROM admin WHERE id = var1;
END IF;
END

maybe it's not clear for some people but reading it again will make it familier to you and very simple.

let's see what we can do with php:
Ex.
$userID = 2 ;

$result = mysql_query( 'call get_data(' . $userID . ')' );

there is more advanced ways to use stored procedures and many many reasons to make it your first choice.
check dev.mysql.com for more and be ready to get the finished release soon.

1 Comments:

At 2:51 AM, Blogger Webincome said...

Good work I liked your posting about
You can find a fantastic database backup tool at http://www.databasebackup.co.uk
backup your database before it is to late......

 

Post a Comment

<< Home