Statistics for MySQL  0.9
sqlplugin.cc
Go to the documentation of this file.
00001 /* sqlplugin.cc (plugin) */
00002 
00003 /***********************************************************************
00004 *  This code is part of Statistics for MySQL.
00005 *
00006 *  Copyright (C) 2011 Heinrich Schuchardt (xypron.glpk@gmx.de)
00007 *
00008 *  Licensed under the Apache License, Version 2.0 (the "License");
00009 *  you may not use this file except in compliance with the License.
00010 *  You may obtain a copy of the License at
00011 *
00012 *      http://www.apache.org/licenses/LICENSE-2.0
00013 *
00014 *  Unless required by applicable law or agreed to in writing, software
00015 *  distributed under the License is distributed on an "AS IS" BASIS,
00016 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017 *  See the License for the specific language governing permissions and
00018 *  limitations under the License.
00019 ***********************************************************************/
00020 
00029 #include <stdio.h>
00030 #include "config.h"
00031 #include "sqlstat.h"
00032 #include "sqlplugin.h"
00033 #include "sqlrand.h"
00034 
00035 using sqlstat::MersenneTwister;
00036 
00037 static int plugin_is_loaded = 0;
00038 
00044 int sqlstat_plugin_init(void *p) {
00045   fprintf(stderr, "Statistics for MySQL %s: "
00046           "plugin loaded.\n", VERSION);
00047   MersenneTwister::init();
00048   plugin_is_loaded = 1;
00049   return 0;
00050 }
00051 
00057 int sqlstat_plugin_deinit(void *p) {
00058   fprintf(stderr, "Statistics for MySQL %s: "
00059           "plugin unloaded.\n", VERSION);
00060   MersenneTwister::deinit();
00061   plugin_is_loaded = 0;
00062   return 0;
00063 }
00064 
00070 int sqlstat_plugin_isloaded() {
00071   return plugin_is_loaded;
00072   }
 All Classes Files Functions Variables Typedefs Defines