|
| 1 | +-- Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
| 2 | +-- |
| 3 | +-- This program is free software; you can redistribute it and/or modify |
| 4 | +-- it under the terms of the GNU General Public License as published by |
| 5 | +-- the Free Software Foundation; version 2 of the License. |
| 6 | +-- |
| 7 | +-- This program is distributed in the hope that it will be useful, |
| 8 | +-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | +-- GNU General Public License for more details. |
| 11 | +-- |
| 12 | +-- You should have received a copy of the GNU General Public License |
| 13 | +-- along with this program; if not, write to the Free Software |
| 14 | +-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | + |
| 16 | +DROP FUNCTION IF EXISTS version_minor; |
| 17 | + |
| 18 | +DELIMITER $$ |
| 19 | + |
| 20 | +CREATE DEFINER='root'@'localhost' FUNCTION version_minor () |
| 21 | + RETURNS TINYINT UNSIGNED |
| 22 | + COMMENT ' |
| 23 | + Description |
| 24 | + ----------- |
| 25 | +
|
| 26 | + Returns the minor (release series) version of MySQL Server. |
| 27 | +
|
| 28 | + Returns |
| 29 | + ----------- |
| 30 | +
|
| 31 | + TINYINT UNSIGNED |
| 32 | +
|
| 33 | + Example |
| 34 | + ----------- |
| 35 | +
|
| 36 | + mysql> SELECT VERSION(), sys.server_minor(); |
| 37 | + +--------------------------------------+---------------------+ |
| 38 | + | VERSION() | sys.version_minor() | |
| 39 | + +--------------------------------------+---------------------+ |
| 40 | + | 5.7.9-enterprise-commercial-advanced | 7 | |
| 41 | + +--------------------------------------+---------------------+ |
| 42 | + 1 row in set (0.00 sec) |
| 43 | + ' |
| 44 | + SQL SECURITY INVOKER |
| 45 | + NOT DETERMINISTIC |
| 46 | + NO SQL |
| 47 | +BEGIN |
| 48 | + RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(VERSION(), '-', 1), '.', 2), '.', -1); |
| 49 | +END$$ |
| 50 | + |
| 51 | +DELIMITER ; |
0 commit comments