Statistics for MySQL  1.1
 All Classes Files Functions Variables Typedefs Macros Pages
sqlplugin.cc
Go to the documentation of this file.
1 /* sqlplugin.cc (plugin) */
2 
3 /***********************************************************************
4 * This code is part of Statistics for MySQL.
5 *
6 * Copyright (C) 2011 Heinrich Schuchardt (xypron.glpk@gmx.de)
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 ***********************************************************************/
20 
29 #include <stdio.h>
30 #include "config.h"
31 #include "sqlstat.h"
32 #include "sqlplugin.h"
33 #include "sqlrand.h"
34 
36 
37 static int plugin_is_loaded = 0;
38 
44 int sqlstat_plugin_init(void *p) {
45  fprintf(stderr, "Statistics for MySQL %s: "
46  "plugin loaded.\n", VERSION);
47  MersenneTwister::init();
48  plugin_is_loaded = 1;
49  return 0;
50 }
51 
57 int sqlstat_plugin_deinit(void *p) {
58  fprintf(stderr, "Statistics for MySQL %s: "
59  "plugin unloaded.\n", VERSION);
60  MersenneTwister::deinit();
61  plugin_is_loaded = 0;
62  return 0;
63 }
64 
71  return plugin_is_loaded;
72 }
Definition of functions for UDFs and plugins.
int sqlstat_plugin_deinit(void *p)
Deinitializes plugin.
Definition: sqlplugin.cc:57
Definitions for random number generations.
int sqlstat_plugin_init(void *p)
Initializes plugin.
Definition: sqlplugin.cc:44
Mersenne Twister random number generator.
Definition: sqlrand.h:60
int sqlstat_plugin_isloaded()
Check if plugin loaded.
Definition: sqlplugin.cc:70
Definition of structures needed to implement a plugin. sqlstat is implemented as a replication plugin...