Storing stored procedure in database
Posted: Wed Apr 08, 2009 2:20 pm
Hi,
How do I store a stored procedure in a database. I am using the following PHP code:
<html>
<body>
<?php
//connection string
$con = mysql_connect("host","username","password");
if(!$con)
{ die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sqlStrProc = "CREATE PROCEDURE SomeName
(IN A VARCHAR(15),IN B VARCHAR(40),OUT C INT)
BEGIN
...........
END;";
mysql_query($sqlStrProc,$con);
mysql_close($con);
?>
</body>
</html>
I wonder if the above method is correct? Further, is there PHP code for checking whether a database is currently holding a stored procedure, function, trigger, etc.? If not what do I look for in the database server to find out if a stored procedure is being held? Many thanks for your help.
How do I store a stored procedure in a database. I am using the following PHP code:
<html>
<body>
<?php
//connection string
$con = mysql_connect("host","username","password");
if(!$con)
{ die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sqlStrProc = "CREATE PROCEDURE SomeName
(IN A VARCHAR(15),IN B VARCHAR(40),OUT C INT)
BEGIN
...........
END;";
mysql_query($sqlStrProc,$con);
mysql_close($con);
?>
</body>
</html>
I wonder if the above method is correct? Further, is there PHP code for checking whether a database is currently holding a stored procedure, function, trigger, etc.? If not what do I look for in the database server to find out if a stored procedure is being held? Many thanks for your help.