~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/plugin_ms.cc

  • Committer: Lee Bieber
  • Date: 2010-11-08 00:56:57 UTC
  • mfrom: (1911.1.4 build)
  • Revision ID: kalebral@gmail.com-20101108005657-tvx0sxjyx29ldrh7
Merge Stewart - Fix bug 616466: auto_increment and PBMS problem - adds test case for this, can no longer reproduce the problem
Merge Stewart - fix bug 621755: blitzdb dictionary not updated after alter table
Merge Stewart - fix bug 668880: remove use of exit in archive storage engine
Merge Gustaf - replace macros functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <drizzled/common.h>
29
29
#include <drizzled/plugin.h>
30
30
#include <drizzled/session.h>
 
31
#include <boost/program_options.hpp>
 
32
#include <drizzled/module/option_map.h>
31
33
using namespace drizzled;
32
34
using namespace drizzled::plugin;
 
35
namespace po= boost::program_options;
33
36
 
34
37
#include "cslib/CSConfig.h"
35
38
#else
45
48
 
46
49
 
47
50
#include "defs_ms.h"
48
 
 
 
51
#include "pbmslib.h"
49
52
 
50
53
/////////////////////////
51
54
// Plugin Definition:
58
61
extern int pbms_init_func(module::Context &registry);
59
62
extern struct drizzled::drizzle_sys_var* pbms_system_variables[];
60
63
 
61
 
static int my_init(module::Context &registry)
 
64
extern uint32_t pbms_port_number;
 
65
 
 
66
static void init_options(drizzled::module::option_context &context)
 
67
{
 
68
  context("port",
 
69
          po::value<uint32_t>(&pbms_port_number)->default_value(DEFAULT_PBMS_PORT),
 
70
          N_("Port number to use for connection or 0 for default PBMS port "));
 
71
}
 
72
 
 
73
 
 
74
static int my_init(module::Context &context)
62
75
{
63
76
        int rtc;
64
 
        
 
77
        const module::option_map &vm= context.getOptions();
 
78
 
 
79
        if (vm.count("port"))
 
80
        {
 
81
          if (pbms_port_number > 65535)
 
82
          {
 
83
            errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid port number\n"));
 
84
            return(-1);
 
85
          }
 
86
        }
 
87
 
65
88
        PBMSParameters::startUp();
66
 
        rtc = pbms_init_func(registry);
 
89
        rtc = pbms_init_func(context);
67
90
        if (rtc == 0) {
68
91
                pbms_events = new PBMSEvents();
69
 
                registry.add(pbms_events);
 
92
                context.add(pbms_events);
70
93
        }
71
 
        
 
94
 
72
95
        return rtc;
73
96
}
74
97
 
82
105
        PLUGIN_LICENSE_GPL,
83
106
        my_init, /* Plugin Init */
84
107
        pbms_system_variables,          /* system variables                */
85
 
        NULL                                            /* config options                  */
 
108
        init_options                                            /* config options                  */
86
109
}
87
110
DRIZZLE_DECLARE_PLUGIN_END;
88
111