~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
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
36
namespace drizzled
37
{
38
520.1.21 by Brian Aker
THD -> Session rename
39
class Session;
1 by brian
clean slate
40
class Item;
1093.1.62 by Monty Taylor
Moved UDFs to slot organization.
41
struct charset_info_st;
1 by brian
clean slate
42
43
/*************************************************************************
44
  Plugin API. Common for all plugin types.
45
*/
46
47
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
48
class sys_var;
1228.1.5 by Monty Taylor
Merged in some naming things.
49
typedef drizzle_lex_string LEX_STRING;
1410.3.4 by Djellel E. Difallah
update references to old my_'s
50
struct option;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
51
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
52
extern boost::filesystem::path plugin_dir;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
53
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
54
namespace plugin { class StorageEngine; }
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
55
1 by brian
clean slate
56
/*
813.2.1 by Toru Maesaka
Renamed mysql_declare_plugin to drizzle_declare_plugin
57
  Macros for beginning and ending plugin declarations. Between
1228.1.5 by Monty Taylor
Merged in some naming things.
58
  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
59
  be a module::Manifest for each plugin to be declared.
1 by brian
clean slate
60
*/
61
62
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.
63
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
64
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
65
#define DRIZZLE_DECLARE_PLUGIN \
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
66
  ::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.
67
68
69
#define DRIZZLE_DECLARE_PLUGIN_END
1633.6.2 by Vijay Samuel
Reverted changes.
70
#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.
71
  DRIZZLE_DECLARE_PLUGIN \
72
  { \
1241.10.2 by Monty Taylor
Added support for embedding the drizzle version number in the plugin file.
73
    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.
74
    STRINGIFY_ARG(PANDORA_MODULE_NAME), \
75
    STRINGIFY_ARG(PANDORA_MODULE_VERSION), \
76
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
77
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
78
    PANDORA_MODULE_LICENSE, \
1633.6.2 by Vijay Samuel
Reverted changes.
79
    init, system, options \
1241.12.6 by Monty Taylor
We don't actually support an array of these, so remove the extra bits.
80
  } 
1093.3.1 by Monty Taylor
Rename of plugin classes.
81
82
971.1.61 by Monty Taylor
Moved a few things around in headers.
83
/*
1 by brian
clean slate
84
  declarations for server variables and command line options
85
*/
86
87
88
#define PLUGIN_VAR_BOOL         0x0001
89
#define PLUGIN_VAR_INT          0x0002
90
#define PLUGIN_VAR_LONG         0x0003
91
#define PLUGIN_VAR_LONGLONG     0x0004
92
#define PLUGIN_VAR_STR          0x0005
93
#define PLUGIN_VAR_UNSIGNED     0x0080
520.1.21 by Brian Aker
THD -> Session rename
94
#define PLUGIN_VAR_SessionLOCAL     0x0100 /* Variable is per-connection */
1 by brian
clean slate
95
#define PLUGIN_VAR_READONLY     0x0200 /* Server variable is read only */
96
#define PLUGIN_VAR_NOSYSVAR     0x0400 /* Not a server variable */
97
#define PLUGIN_VAR_NOCMDOPT     0x0800 /* Not a command line option */
98
#define PLUGIN_VAR_NOCMDARG     0x1000 /* No argument for cmd line */
99
#define PLUGIN_VAR_RQCMDARG     0x0000 /* Argument required for cmd line */
100
#define PLUGIN_VAR_OPCMDARG     0x2000 /* Argument optional for cmd line */
101
#define PLUGIN_VAR_MEMALLOC     0x8000 /* String needs memory allocated */
102
1228.1.5 by Monty Taylor
Merged in some naming things.
103
struct drizzle_sys_var;
104
struct drizzle_value;
1 by brian
clean slate
105
106
/*
107
  SYNOPSIS
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
108
    (*var_check_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
109
      session               thread handle
1 by brian
clean slate
110
      var               dynamic variable being altered
111
      save              pointer to temporary storage
112
      value             user provided value
113
  RETURN
114
    0   user provided value is OK and the update func may be called.
115
    any other value indicates error.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
116
1 by brian
clean slate
117
  This function should parse the user provided value and store in the
118
  provided temporary storage any data as required by the update func.
119
  There is sufficient space in the temporary storage to store a double.
120
  Note that the update func may not be called if any other error occurs
121
  so any memory allocated should be thread-local so that it may be freed
122
  automatically at the end of the statement.
123
*/
124
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
125
typedef int (*var_check_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
126
                                    drizzle_sys_var *var,
127
                                    void *save, drizzle_value *value);
1 by brian
clean slate
128
129
/*
130
  SYNOPSIS
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
131
    (*var_update_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
132
      session               thread handle
1 by brian
clean slate
133
      var               dynamic variable being altered
134
      var_ptr           pointer to dynamic variable
135
      save              pointer to temporary storage
136
   RETURN
137
     NONE
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
138
1 by brian
clean slate
139
   This function should use the validated value stored in the temporary store
140
   and persist it in the provided pointer to the dynamic variable.
141
   For example, strings may require memory to be allocated.
142
*/
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
143
typedef void (*var_update_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
144
                                      drizzle_sys_var *var,
1 by brian
clean slate
145
                                      void *var_ptr, const void *save);
146
147
148
1251.2.2 by Jay Pipes
Pulls MyISAM-specific server variables into the MyISAM
149
/*
150
  skeleton of a plugin variable - portion of structure common to all.
151
*/
152
struct drizzle_sys_var
153
{
154
};
155
1410.3.4 by Djellel E. Difallah
update references to old my_'s
156
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
157
1228.1.5 by Monty Taylor
Merged in some naming things.
158
struct drizzle_value
1 by brian
clean slate
159
{
1228.1.5 by Monty Taylor
Merged in some naming things.
160
  int (*value_type)(drizzle_value *);
161
  const char *(*val_str)(drizzle_value *, char *buffer, int *length);
162
  int (*val_real)(drizzle_value *, double *realbuf);
163
  int (*val_int)(drizzle_value *, int64_t *intbuf);
1 by brian
clean slate
164
};
165
166
167
/*************************************************************************
168
  Miscellaneous functions for plugin implementors
169
*/
170
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
171
extern bool plugin_init(module::Registry &registry,
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
172
                        boost::program_options::options_description &long_options);
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
173
extern bool plugin_finalize(module::Registry &registry);
1757.2.3 by Monty Taylor
Made printing of --help work via program_options from the core. Removed
174
extern void my_print_help_inc_plugins(option *options);
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
175
extern bool plugin_is_ready(const LEX_STRING *name, int type);
176
extern void plugin_sessionvar_init(Session *session);
177
extern void plugin_sessionvar_cleanup(Session *session);
178
520.1.22 by Brian Aker
Second pass of thd cleanup
179
int session_in_lock_tables(const Session *session);
180
int session_tablespace_op(const Session *session);
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
181
void set_session_proc_info(Session *session, const char *info);
182
const char *get_session_proc_info(Session *session);
520.1.22 by Brian Aker
Second pass of thd cleanup
183
int64_t session_test_options(const Session *session, int64_t test_options);
184
int session_sql_command(const Session *session);
1578.7.1 by Stewart Smith
change session_tx_isolation() to return enum_tx_isolation instead of int. This means that in engines we can properly use a switch statement on the enum values and get warnings if we miss one.
185
enum_tx_isolation session_tx_isolation(const Session *session);
1 by brian
clean slate
186
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
187
void compose_plugin_add(std::vector<std::string> options);
188
void compose_plugin_remove(std::vector<std::string> options);
189
void notify_plugin_load(std::string in_plugin_load);
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
190
191
1 by brian
clean slate
192
/**
193
  Create a temporary file.
194
195
  @details
196
  The temporary file is created in a location specified by the mysql
197
  server configuration (--tmpdir option).  The caller does not need to
198
  delete the file, it will be deleted automatically.
199
200
  @param prefix  prefix for temporary file name
201
  @retval -1    error
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
202
  @retval >= 0  a file handle that can be passed to dup or internal::my_close
1 by brian
clean slate
203
*/
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
204
int tmpfile(const char *prefix);
1 by brian
clean slate
205
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
206
} /* namespace drizzled */
207
1122.2.10 by Monty Taylor
Fixed all of the include guards.
208
#endif /* DRIZZLED_PLUGIN_H */
1 by brian
clean slate
209