mysql评论信息显示

c86crjj0  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(434)

关于评论显示的问题,示例如下:

DROP FUNCTION IF EXISTS `foo`;
delimiter //
-- comment1
-- comment2
-- comment3
CREATE FUNCTION foo()
  RETURNS int(1)
BEGIN   
SET @var1 = @var1 + 1;   /* information here */
RETURN @var1;   
END;
//
delimiter ;

show create function foo;

函数foo的结果不包含任何注解,是否有任何注解仅用于开发目的?

lf5gs5x2

lf5gs5x21#

只有在函数体中包含注解时。
如果您在*nix平台上使用mysql cli,您可以通过设置寻呼机来显示注解,然后使用show create procedure dbname.procedure\u name或查询information\u schema routines表。以后别忘了重设寻呼机。
例如

mysql> pager grep '\-\-'
PAGER set to 'grep '\-\-''

mysql> select routine_definition from information_schema.routines where routine_name = 'myaes_convert'\G
  DECLARE gtg TINYINT DEFAULT 0;     -- OK to proceed
  DECLARE vtable_schema VARCHAR(64); -- cursor var
  DECLARE vtable_name VARCHAR(64);   -- cursor var 
    -- Perform Backups on columns
    -- Perform Index backup
    -- Drop indexes
    -- Call column converter
    -- Create triggers on table
    -- Restore indexes and log
    -- rename the table _myaes
    -- create the view for this table
  SELECT 1; -- Phew!
1 row in set (0.02 sec)

mysql> pager
Default pager wasn't set, using stdout.

或者

mysql> pager grep '\-\-'
PAGER set to 'grep '\-\-''

mysql> show create procedure myaes.myaes_convert\G
  DECLARE gtg TINYINT DEFAULT 0;     -- OK to proceed
  DECLARE vtable_schema VARCHAR(64); -- cursor var
  DECLARE vtable_name VARCHAR(64);   -- cursor var 
    -- Perform Backups on columns
    -- Perform Index backup
    -- Drop indexes
    -- Call column converter
    -- Create triggers on table
    -- Restore indexes and log
    -- rename the table _myaes
    -- create the view for this table
  SELECT 1; -- Phew!
1 row in set (0.00 sec)

mysql> pager
Default pager wasn't set, using stdout.

相关问题