~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
5
 *
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; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
1 by brian
clean slate
19
518 by Brian Aker
Firt pass to remove C/C++ funkiness around declaration of THD.
20
#ifndef DRIZZLED_PLUGIN_H
21
#define DRIZZLED_PLUGIN_H
1 by brian
clean slate
22
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
23
#include <boost/program_options.hpp>
24
#include <boost/filesystem.hpp>
25
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
26
#include "drizzled/module/manifest.h"
27
#include "drizzled/module/module.h"
1253.2.1 by Monty Taylor
Moved plugin versioning out of drizzled/configmake.h and into drizzled/plugin/version.h. Also fixed header include paths.
28
#include "drizzled/plugin/version.h"
1530.2.6 by Monty Taylor
Moved plugin::Context to module::Context.
29
#include "drizzled/module/context.h"
1241.9.44 by Monty Taylor
Made magic with cached_directory.
30
#include "drizzled/definitions.h"
316 by Brian Aker
First pass of new sql_db.cc work
31
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
32
#include "drizzled/lex_string.h"
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
33
#include "drizzled/sys_var.h"
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
34
#include "drizzled/xid.h"
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
35
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
36
#include "drizzled/visibility.h"
37
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
38
namespace drizzled
39
{
40
520.1.21 by Brian Aker
THD -> Session rename
41
class Session;
1 by brian
clean slate
42
class Item;
1093.1.62 by Monty Taylor
Moved UDFs to slot organization.
43
struct charset_info_st;
1 by brian
clean slate
44
45
/*************************************************************************
46
  Plugin API. Common for all plugin types.
47
*/
48
49
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
50
class sys_var;
1410.3.4 by Djellel E. Difallah
update references to old my_'s
51
struct option;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
52
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
53
extern boost::filesystem::path plugin_dir;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
54
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
55
namespace plugin { class StorageEngine; }
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
56
1 by brian
clean slate
57
/*
813.2.1 by Toru Maesaka
Renamed mysql_declare_plugin to drizzle_declare_plugin
58
  Macros for beginning and ending plugin declarations. Between
1228.1.5 by Monty Taylor
Merged in some naming things.
59
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
60
  be a module::Manifest for each plugin to be declared.
1 by brian
clean slate
61
*/
62
63
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
64
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
65
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
66
#define DRIZZLE_DECLARE_PLUGIN \
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
67
  DRIZZLED_API ::drizzled::module::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
1241.12.6 by Monty Taylor
We don't actually support an array of these, so remove the extra bits.
68
69
70
#define DRIZZLE_DECLARE_PLUGIN_END
1633.6.2 by Vijay Samuel
Reverted changes.
71
#define DRIZZLE_PLUGIN(init,system,options) \
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
72
  DRIZZLE_DECLARE_PLUGIN \
73
  { \
1241.10.2 by Monty Taylor
Added support for embedding the drizzle version number in the plugin file.
74
    DRIZZLE_VERSION_ID, \
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
75
    STRINGIFY_ARG(PANDORA_MODULE_NAME), \
76
    STRINGIFY_ARG(PANDORA_MODULE_VERSION), \
77
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
78
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
79
    PANDORA_MODULE_LICENSE, \
2095.3.1 by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list.
80
    init, \
81
    STRINGIFY_ARG(PANDORA_MODULE_DEPENDENCIES), \
82
    options \
1241.12.6 by Monty Taylor
We don't actually support an array of these, so remove the extra bits.
83
  } 
1093.3.1 by Monty Taylor
Rename of plugin classes.
84
85
971.1.61 by Monty Taylor
Moved a few things around in headers.
86
/*
1 by brian
clean slate
87
  declarations for server variables and command line options
88
*/
89
90
91
#define PLUGIN_VAR_BOOL         0x0001
92
#define PLUGIN_VAR_INT          0x0002
93
#define PLUGIN_VAR_LONG         0x0003
94
#define PLUGIN_VAR_LONGLONG     0x0004
95
#define PLUGIN_VAR_STR          0x0005
96
#define PLUGIN_VAR_UNSIGNED     0x0080
520.1.21 by Brian Aker
THD -> Session rename
97
#define PLUGIN_VAR_SessionLOCAL     0x0100 /* Variable is per-connection */
1 by brian
clean slate
98
#define PLUGIN_VAR_READONLY     0x0200 /* Server variable is read only */
99
#define PLUGIN_VAR_NOSYSVAR     0x0400 /* Not a server variable */
100
#define PLUGIN_VAR_NOCMDOPT     0x0800 /* Not a command line option */
101
#define PLUGIN_VAR_NOCMDARG     0x1000 /* No argument for cmd line */
102
#define PLUGIN_VAR_RQCMDARG     0x0000 /* Argument required for cmd line */
103
#define PLUGIN_VAR_OPCMDARG     0x2000 /* Argument optional for cmd line */
104
#define PLUGIN_VAR_MEMALLOC     0x8000 /* String needs memory allocated */
105
1228.1.5 by Monty Taylor
Merged in some naming things.
106
struct drizzle_sys_var;
107
struct drizzle_value;
1 by brian
clean slate
108
109
/*
110
  SYNOPSIS
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
111
    (*var_check_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
112
      session               thread handle
1 by brian
clean slate
113
      var               dynamic variable being altered
114
      save              pointer to temporary storage
115
      value             user provided value
116
  RETURN
117
    0   user provided value is OK and the update func may be called.
118
    any other value indicates error.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
119
1 by brian
clean slate
120
  This function should parse the user provided value and store in the
121
  provided temporary storage any data as required by the update func.
122
  There is sufficient space in the temporary storage to store a double.
123
  Note that the update func may not be called if any other error occurs
124
  so any memory allocated should be thread-local so that it may be freed
125
  automatically at the end of the statement.
126
*/
127
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
128
typedef int (*var_check_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
129
                                    drizzle_sys_var *var,
130
                                    void *save, drizzle_value *value);
1 by brian
clean slate
131
132
/*
133
  SYNOPSIS
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
134
    (*var_update_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
135
      session               thread handle
1 by brian
clean slate
136
      var               dynamic variable being altered
137
      var_ptr           pointer to dynamic variable
138
      save              pointer to temporary storage
139
   RETURN
140
     NONE
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
141
1 by brian
clean slate
142
   This function should use the validated value stored in the temporary store
143
   and persist it in the provided pointer to the dynamic variable.
144
   For example, strings may require memory to be allocated.
145
*/
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
146
typedef void (*var_update_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
147
                                      drizzle_sys_var *var,
1 by brian
clean slate
148
                                      void *var_ptr, const void *save);
149
150
151
1251.2.2 by Jay Pipes
Pulls MyISAM-specific server variables into the MyISAM
152
/*
153
  skeleton of a plugin variable - portion of structure common to all.
154
*/
155
struct drizzle_sys_var
156
{
157
};
158
1410.3.4 by Djellel E. Difallah
update references to old my_'s
159
void plugin_opt_set_limits(option *options, const drizzle_sys_var *opt);
1251.2.2 by Jay Pipes
Pulls MyISAM-specific server variables into the MyISAM
160
1228.1.5 by Monty Taylor
Merged in some naming things.
161
struct drizzle_value
1 by brian
clean slate
162
{
1228.1.5 by Monty Taylor
Merged in some naming things.
163
  int (*value_type)(drizzle_value *);
164
  const char *(*val_str)(drizzle_value *, char *buffer, int *length);
165
  int (*val_real)(drizzle_value *, double *realbuf);
166
  int (*val_int)(drizzle_value *, int64_t *intbuf);
1 by brian
clean slate
167
};
168
169
170
/*************************************************************************
171
  Miscellaneous functions for plugin implementors
172
*/
173
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
174
extern bool plugin_init(module::Registry &registry,
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
175
                        boost::program_options::options_description &long_options);
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
176
extern bool plugin_finalize(module::Registry &registry);
2079.4.1 by Brian Aker
Merge in code to all plugins to do whatever they need to do once all other
177
extern void plugin_startup_window(module::Registry &registry, drizzled::Session &session);
1757.2.3 by Monty Taylor
Made printing of --help work via program_options from the core. Removed
178
extern void my_print_help_inc_plugins(option *options);
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
179
extern bool plugin_is_ready(const LEX_STRING *name, int type);
180
extern void plugin_sessionvar_init(Session *session);
181
extern void plugin_sessionvar_cleanup(Session *session);
182
520.1.22 by Brian Aker
Second pass of thd cleanup
183
int session_in_lock_tables(const Session *session);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
184
DRIZZLED_API int session_tablespace_op(const Session *session);
185
DRIZZLED_API void set_session_proc_info(Session *session, const char *info);
186
DRIZZLED_API const char *get_session_proc_info(Session *session);
187
DRIZZLED_API int64_t session_test_options(const Session *session, int64_t test_options);
188
DRIZZLED_API int session_sql_command(const Session *session);
189
DRIZZLED_API enum_tx_isolation session_tx_isolation(const Session *session);
1 by brian
clean slate
190
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
191
void compose_plugin_add(std::vector<std::string> options);
192
void compose_plugin_remove(std::vector<std::string> options);
193
void notify_plugin_load(std::string in_plugin_load);
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
194
195
1 by brian
clean slate
196
/**
197
  Create a temporary file.
198
199
  @details
200
  The temporary file is created in a location specified by the mysql
201
  server configuration (--tmpdir option).  The caller does not need to
202
  delete the file, it will be deleted automatically.
203
204
  @param prefix  prefix for temporary file name
205
  @retval -1    error
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
206
  @retval >= 0  a file handle that can be passed to dup or internal::my_close
1 by brian
clean slate
207
*/
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
208
DRIZZLED_API int tmpfile(const char *prefix);
1 by brian
clean slate
209
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
210
} /* namespace drizzled */
211
1122.2.10 by Monty Taylor
Fixed all of the include guards.
212
#endif /* DRIZZLED_PLUGIN_H */
1 by brian
clean slate
213