In this chapter we looked at the process of creating and managing stored objects (procedures, functions, and triggers). Let's conclude with an outline of what we regard as the best practices for creating and managing stored objects:

  • Make sure that the reference (e.g., official) copy of each of your stored programs exists as a file on disk, not as the copy stored in the MySQL server. Stored programs might need to be shared between multiple servers, and you therefore need at least one copynot on a serverthat represents the current version.
  • Use a version control system to maintain a copy of any version of a stored program that is deployed to a MySQL server. In other words, subject stored program code to the same discipline that you apply to other program code.
  • When you are editing a stored program, check it out of the source control system and load the checked-out copy into the MySQL Query Browser or other tool.

    Figure 7-14. Viewing the INFORMATION_SCHEMA.ROUTINES table

  • When you are satisfied with your changes, save the stored program code to a disk file and check it into the version control system.
  • Deploy the stored program by creating command-line routines using the MySQL client program, and embed these into Make files or other build/deploy scripts that you can use to apply schema changes and other server object changes.

    Figure 7-15. Viewing the INFORMATION_SCHEMA.TRIGGERS table

MySQL Stored Procedure Programming
MySQL Stored Procedure Programming
ISBN: 0596100892
EAN: 2147483647
Year: 2004
Pages: 208
Simiral book on Amazon © 2008-2017.
If you may any questions please contact us: