To use stored procedures with MySQL 5.x, you must first have access native MySQL latest version. Ie version 46b.
You will find the native access to the following address:
http://www.pcsoft.fr/st/telec/modules-communs-11/mysql.htm
Either a client file:
Version: MySQL 5.0.45
- Sample stored procedure with parameters:
1 - Create the stored procedure on the server
s Proc is a string = [
"DROP PROCEDURE IF EXISTS` `procstok. Simpleproc1` `;
simpleproc1 CREATE PROCEDURE (OUT param1 INT) BEGIN SELECT COUNT (*) INTO param1 FROM customer; END;
]
scReq is a Data Source
/ / Execute the query
SI NOT HExécuteRequêteSQL ( scReq , MaConnexion1 , hRequêteSansCorrection , s Proc ) THEN
error ()
ELSE
Info ( "stored procedure created" )
END
2 - Run the stored procedure:
sd Req is a Data Source
IF NOT HExécuteRequêteSQL (sd Req , MaConnexion1 , hRequêteSansCorrection , "call simpleproc1 (@ a) select @ a;" ) THEN
error ()
ELSE
Info ( "Won" )
/ / Read the result of the procedure
HReadFirst (Sd Req , hSansRafraîchir )
Trace (sd Req. @ a)
END
NOTE: Constant hSansRafraîchir can not re-execute the query.
0 comments:
Post a Comment