Home » Performance » MySQL » "go to" command in an sql script
"go to" command in an sql script [message #3095] Sun, 18 May 2008 11:17 Go to next message
remyvrs  is currently offline remyvrs
Messages: 2
Registered: May 2008
Junior Member
hi guys!

i need a mysql sql script that should execute from one point forward so the only solution i can think of is a command that should do something like:
GOTO "LABEL";
...
...
LABEL;


for those who counts why i need here is what i intend:
i want to automate my deploy of structure from the production db so in order to keep track of all modifications made on the developer server i shall put them in an sql file and tag them... the tag should stay in one table from db. when a deploy it's done, according to the tag existing in production database the script would execute from one point (corresponding to the current tag) to
the end and so the structures would be the same...
this is why i need in the script to GOTO same LABEL.
thanks in advance!!
or maybe someone will provide me with another idea or solution for my need...
Re: "go to" command in an sql script [message #3138 is a reply to message #3095 ] Wed, 28 May 2008 01:16 Go to previous messageGo to next message
debug  is currently offline debug
Messages: 132
Registered: March 2008
Senior Member

there is no GOTO in MySql stored procedures. You could instead:
- set a flag and test for it
- return from the procedure if no updates should be made, and add the updates after the returns
- put the updates in another stored procedure, and call it in your if statements


Mikhail Solovyev, MySQL Performance Expert
MySQL Performance Blog
MySQL Consulting
Re: "go to" command in an sql script [message #3140 is a reply to message #3138 ] Wed, 28 May 2008 03:00 Go to previous message
remyvrs  is currently offline remyvrs
Messages: 2
Registered: May 2008
Junior Member
your hint is very good for me ...
Thanks very much!!
Previous Topic:It takes hours before Mysql 4.1 is ready for connections
Next Topic:Innodb high memory load make mysql crash [help]
Goto Forum:
  


Current Time: Sun Jul 5 17:21:22 EDT 2009

Total time taken to generate the page: 0.01228 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.