1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include "plugin/registry_dictionary/dictionary.h"
24
#include "drizzled/module/library.h"
27
using namespace drizzled;
30
* Suffix _STRING was added because sys/param.h on OSX defines a BSD symbol
31
* to the version of BSD being run. FAIL
33
static const string GPL_STRING("GPL");
34
static const string LGPL_STRING("LGPL");
35
static const string BSD_STRING("BSD");
36
static const string PROPRIETARY_STRING("PROPRIETARY");
38
ModulesTool::ModulesTool() :
39
plugin::TableFunction("DATA_DICTIONARY", "MODULES")
41
add_field("MODULE_NAME");
42
add_field("MODULE_VERSION", 20);
43
add_field("MODULE_AUTHOR");
44
add_field("IS_BUILTIN", plugin::TableFunction::BOOLEAN, 0, false);
45
add_field("MODULE_LIBRARY", 254);
46
add_field("MODULE_DESCRIPTION", 254);
47
add_field("MODULE_LICENSE", 80);
50
ModulesTool::Generator::Generator(Field **arg) :
51
plugin::TableFunction::Generator(arg)
53
module::Registry ®istry= module::Registry::singleton();
54
modules= registry.getList();
58
bool ModulesTool::Generator::populate()
60
if (it == modules.end())
64
module::Module *module= *it;
65
const module::Manifest &manifest= module->getManifest();
68
push(module->getName());
71
push(manifest.version ? manifest.version : 0);
74
manifest.author ? push(manifest.author) : push();
77
push((module->plugin_dl == NULL));
80
push((module->plugin_dl == NULL) ? "builtin" : module->plugin_dl->getName());
82
/* MODULE_DESCRIPTION */
83
manifest.descr ? push(manifest.descr) : push();
86
switch (manifest.license) {
87
case PLUGIN_LICENSE_GPL:
90
case PLUGIN_LICENSE_BSD:
93
case PLUGIN_LICENSE_LGPL:
97
push(PROPRIETARY_STRING);