MySQL Procedures : Standard/Best Place For Code Documentation? -
i'd put paragraph or documentation on each of mysql procedures: date, author, purpose, etc. is there standard, accepted, or best place put kind of documentation?
for example, in mssql, ide's generate template start coding procedure; comes little place code documentation.
use [mydatabase] go /****** object: storedprocedure [dbo].[storerecord] script date: 04/29/2010 09:21:57 ******/ set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: -- create date: -- description: -- ============================================= alter procedure [dbo].[storerecord] -- ... more code ...
mysql provides short (64 character) comment associated each stored procedure (function) displayed part of show create procedure
(or function
) results. beyond comments in code write defined stored procedures , functions stripped when mysql parses them. example:
mysql> delimiter // mysql> create function simpleexample( cid int ) returns int comment 'returns argument plus 5' /* =============== none of comment gets stored in database. =============== */ begin return cid + 5; end// mysql> delimiter ; mysql> show create function simpleexample; +---------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | function | sql_mode | create function | +---------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | simpleexample | | create definer=`ovis`@`localhost` function `simpleexample`( cid int ) returns int(11) comment 'returns argument plus 5' begin return cid + 5; end | +---------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ mysql> select simpleexample(8); +------------------+ | simpleexample(8) | +------------------+ | 13 | +------------------+ 1 row in set (0.00 sec)
i know of no other standard including documentation part of stored procedures , functions. there plenty of people document code, of course, each project has own practices. if you're used to, stick it; there's nothing preventing same comments working in mysql. if want way locate comments function in live database, might consider using comment
characteristic point file+revision in source code containing original definition of function additional comments exist.
Comments
Post a Comment