This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from MarkLeith/development
Release 1.5.0
- Loading branch information
Showing
171 changed files
with
8,249 additions
and
662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
-- Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. | ||
-- | ||
-- This program is free software; you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation; version 2 of the License. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with this program; if not, write to the Free Software | ||
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
DROP FUNCTION IF EXISTS format_path; | ||
|
||
DELIMITER $$ | ||
|
||
CREATE DEFINER='root'@'localhost' FUNCTION format_path ( | ||
path VARCHAR(512) | ||
) | ||
RETURNS VARCHAR(512) CHARSET UTF8 | ||
COMMENT ' | ||
Description | ||
----------- | ||
Takes a raw path value, and strips out the datadir or tmpdir | ||
replacing with @@datadir and @@tmpdir respectively. | ||
Also normalizes the paths across operating systems, so backslashes | ||
on Windows are converted to forward slashes | ||
Parameters | ||
----------- | ||
path (VARCHAR(512)): | ||
The raw file path value to format. | ||
Returns | ||
----------- | ||
VARCHAR(512) CHARSET UTF8 | ||
Example | ||
----------- | ||
mysql> select @@datadir; | ||
+-----------------------------------------------+ | ||
| @@datadir | | ||
+-----------------------------------------------+ | ||
| /Users/mark/sandboxes/SmallTree/AMaster/data/ | | ||
+-----------------------------------------------+ | ||
1 row in set (0.06 sec) | ||
mysql> select format_path(\'/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD\') AS path; | ||
+--------------------------+ | ||
| path | | ||
+--------------------------+ | ||
| @@datadir/mysql/proc.MYD | | ||
+--------------------------+ | ||
1 row in set (0.03 sec) | ||
' | ||
SQL SECURITY INVOKER | ||
DETERMINISTIC | ||
NO SQL | ||
BEGIN | ||
DECLARE v_path VARCHAR(512); | ||
DECLARE v_undo_dir VARCHAR(1024); | ||
|
||
-- OSX hides /private/ in variables, but Performance Schema does not | ||
IF path LIKE '/private/%' | ||
THEN SET v_path = REPLACE(path, '/private', ''); | ||
ELSE SET v_path = path; | ||
END IF; | ||
|
||
-- @@global.innodb_undo_directory is only set when separate undo logs are used | ||
SET v_undo_dir = IFNULL((SELECT VARIABLE_NAME FROM performance_schema.global_variables WHERE VARIABLE_NAME = 'innodb_undo_directory'), ''); | ||
|
||
IF v_path IS NULL THEN RETURN NULL; | ||
ELSEIF v_path LIKE CONCAT(@@global.datadir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, @@global.datadir, '@@datadir/'), '\\\\', ''), '\\', '/'); | ||
ELSEIF v_path LIKE CONCAT(@@global.tmpdir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, @@global.tmpdir, '@@tmpdir/'), '\\\\', ''), '\\', '/'); | ||
ELSEIF v_path LIKE CONCAT(@@global.slave_load_tmpdir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, @@global.slave_load_tmpdir, '@@slave_load_tmpdir/'), '\\\\', ''), '\\', '/'); | ||
ELSEIF v_path LIKE CONCAT(@@global.innodb_data_home_dir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, @@global.innodb_data_home_dir, '@@innodb_data_home_dir/'), '\\\\', ''), '\\', '/'); | ||
ELSEIF v_path LIKE CONCAT(@@global.innodb_log_group_home_dir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, @@global.innodb_log_group_home_dir, '@@innodb_log_group_home_dir/'), '\\\\', ''), '\\', '/'); | ||
ELSEIF v_path LIKE CONCAT(v_undo_dir, '%') ESCAPE '|' THEN | ||
RETURN REPLACE(REPLACE(REPLACE(v_path, v_undo_dir, '@@innodb_undo_directory/'), '\\\\', ''), '\\', '/'); | ||
ELSE RETURN v_path; | ||
END IF; | ||
END$$ | ||
|
||
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
-- Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. | ||
-- | ||
-- This program is free software; you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation; version 2 of the License. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with this program; if not, write to the Free Software | ||
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
DROP FUNCTION IF EXISTS list_add; | ||
|
||
DELIMITER $$ | ||
|
||
CREATE DEFINER='root'@'localhost' FUNCTION list_add ( | ||
in_list TEXT, | ||
in_add_value TEXT | ||
) | ||
RETURNS TEXT | ||
COMMENT ' | ||
Description | ||
----------- | ||
Takes a list, and a value to add to the list, and returns the resulting list. | ||
Useful for altering certain session variables, like sql_mode or optimizer_switch for instance. | ||
Parameters | ||
----------- | ||
in_list (TEXT): | ||
The comma separated list to add a value to | ||
in_add_value (TEXT): | ||
The value to add to the input list | ||
Returns | ||
----------- | ||
TEXT | ||
Example | ||
-------- | ||
mysql> select @@sql_mode; | ||
+-----------------------------------------------------------------------------------+ | ||
| @@sql_mode | | ||
+-----------------------------------------------------------------------------------+ | ||
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | | ||
+-----------------------------------------------------------------------------------+ | ||
1 row in set (0.00 sec) | ||
mysql> set sql_mode = sys.list_add(@@sql_mode, ''ANSI_QUOTES''); | ||
Query OK, 0 rows affected (0.06 sec) | ||
mysql> select @@sql_mode; | ||
+-----------------------------------------------------------------------------------------------+ | ||
| @@sql_mode | | ||
+-----------------------------------------------------------------------------------------------+ | ||
| ANSI_QUOTES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | | ||
+-----------------------------------------------------------------------------------------------+ | ||
1 row in set (0.00 sec) | ||
' | ||
SQL SECURITY INVOKER | ||
DETERMINISTIC | ||
CONTAINS SQL | ||
BEGIN | ||
|
||
IF (in_add_value IS NULL) THEN | ||
SIGNAL SQLSTATE '02200' | ||
SET MESSAGE_TEXT = 'Function sys.list_add: in_add_value input variable should not be NULL', | ||
MYSQL_ERRNO = 1138; | ||
END IF; | ||
|
||
IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN | ||
-- return the new value as a single value list | ||
RETURN in_add_value; | ||
END IF; | ||
|
||
RETURN (SELECT CONCAT(TRIM(BOTH ',' FROM TRIM(in_list)), ',', in_add_value)); | ||
|
||
END$$ | ||
|
||
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
-- Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. | ||
-- | ||
-- This program is free software; you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation; version 2 of the License. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with this program; if not, write to the Free Software | ||
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
DROP FUNCTION IF EXISTS list_drop; | ||
|
||
DELIMITER $$ | ||
|
||
CREATE DEFINER='root'@'localhost' FUNCTION list_drop ( | ||
in_list TEXT, | ||
in_drop_value TEXT | ||
) | ||
RETURNS TEXT | ||
COMMENT ' | ||
Description | ||
----------- | ||
Takes a list, and a value to attempt to remove from the list, and returns the resulting list. | ||
Useful for altering certain session variables, like sql_mode or optimizer_switch for instance. | ||
Parameters | ||
----------- | ||
in_list (TEXT): | ||
The comma separated list to drop a value from | ||
in_drop_value (TEXT): | ||
The value to drop from the input list | ||
Returns | ||
----------- | ||
TEXT | ||
Example | ||
-------- | ||
mysql> select @@sql_mode; | ||
+-----------------------------------------------------------------------------------------------+ | ||
| @@sql_mode | | ||
+-----------------------------------------------------------------------------------------------+ | ||
| ANSI_QUOTES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | | ||
+-----------------------------------------------------------------------------------------------+ | ||
1 row in set (0.00 sec) | ||
mysql> set sql_mode = sys.list_drop(@@sql_mode, ''ONLY_FULL_GROUP_BY''); | ||
Query OK, 0 rows affected (0.03 sec) | ||
mysql> select @@sql_mode; | ||
+----------------------------------------------------------------------------+ | ||
| @@sql_mode | | ||
+----------------------------------------------------------------------------+ | ||
| ANSI_QUOTES,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | | ||
+----------------------------------------------------------------------------+ | ||
1 row in set (0.00 sec) | ||
' | ||
SQL SECURITY INVOKER | ||
DETERMINISTIC | ||
CONTAINS SQL | ||
BEGIN | ||
|
||
IF (in_drop_value IS NULL) THEN | ||
SIGNAL SQLSTATE '02200' | ||
SET MESSAGE_TEXT = 'Function sys.list_drop: in_drop_value input variable should not be NULL', | ||
MYSQL_ERRNO = 1138; | ||
END IF; | ||
|
||
IF (in_list IS NULL OR LENGTH(in_list) = 0) THEN | ||
-- return the list as it was passed in | ||
RETURN in_list; | ||
END IF; | ||
|
||
-- ensure that leading / trailing commas are remove, support values with either spaces or not between commas | ||
RETURN (SELECT TRIM(BOTH ',' FROM REPLACE(REPLACE(CONCAT(',', in_list), CONCAT(',', in_drop_value), ''), CONCAT(', ', in_drop_value), ''))); | ||
|
||
END$$ | ||
|
||
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.