diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2017-03-10 20:25:30 +0700 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2017-05-05 20:36:30 +0300 |
commit | 0e0103893691eae714e2f278498300b8d005cebf (patch) | |
tree | 0a94525678b217c88f56a55afe5ce17076d5b06b /plugin | |
parent | cbb674282aab725acb87c73dc2fb4699eb8b52c2 (diff) | |
download | mariadb-git-0e0103893691eae714e2f278498300b8d005cebf.tar.gz |
SQL: forced, hidden versioning [closes #32]
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/versioning/CMakeLists.txt | 17 | ||||
-rw-r--r-- | plugin/versioning/versioning.cc | 69 |
2 files changed, 86 insertions, 0 deletions
diff --git a/plugin/versioning/CMakeLists.txt b/plugin/versioning/CMakeLists.txt new file mode 100644 index 00000000000..9ae0b58af66 --- /dev/null +++ b/plugin/versioning/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2016, MariaDB corporation. 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 + +MYSQL_ADD_PLUGIN(versioning versioning.cc + MODULE_ONLY MODULE_OUTPUT_NAME "versioning" COMPONENT Test) diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc new file mode 100644 index 00000000000..44faf85aef7 --- /dev/null +++ b/plugin/versioning/versioning.cc @@ -0,0 +1,69 @@ +/* Copyright (c) 2016, MariaDB corporation. 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 */ + +#include <mysql_version.h> +#include <mysqld.h> +#include "sql_plugin.h" // st_plugin_int + +/* + Disable __attribute__() on non-gcc compilers. +*/ +#if !defined(__attribute__) && !defined(__GNUC__) +#define __attribute__(A) +#endif + +static int forced_versioning_init(void *p __attribute__ ((unused))) +{ + + DBUG_ENTER("forced_versioning_init"); + vers_force= true; + vers_hide= true; + DBUG_RETURN(0); +} + +static int forced_versioning_deinit(void *p __attribute__ ((unused))) +{ + DBUG_ENTER("forced_versioning_deinit"); + vers_force= false; + vers_hide= false; + DBUG_RETURN(0); +} + + +struct st_mysql_daemon forced_versioning_plugin= +{ MYSQL_DAEMON_INTERFACE_VERSION }; + +/* + Plugin library descriptor +*/ + +maria_declare_plugin(forced_versioning) +{ + MYSQL_DAEMON_PLUGIN, + &forced_versioning_plugin, + "forced_versioning", + "Natsys Lab", + "Enable System Vesioning for all newly created tables", + PLUGIN_LICENSE_GPL, + forced_versioning_init, /* Plugin Init */ + forced_versioning_deinit, /* Plugin Deinit */ + 0x0100 /* 1.0 */, + NULL, /* status variables */ + NULL, /* system variables */ + "1.0", /* string version */ + MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* maturity */ +} +maria_declare_plugin_end; |