16
16
#include <drizzled/server_includes.h>
17
17
#include <mysys/my_getopt.h>
18
#include <authentication.h>
20
#include <drizzled/drizzled_error_messages.h>
19
#include <drizzled/authentication.h>
20
#include <drizzled/logging.h>
21
#include <drizzled/errmsg.h>
22
#include <drizzled/configvar.h>
23
#include <drizzled/qcache.h>
24
#include <drizzled/parser.h>
25
#include <drizzled/scheduling.h>
29
#include <drizzled/error.h>
30
#include <drizzled/gettext.h>
21
32
#define REPORT_TO_LOG 1
22
33
#define REPORT_TO_USER 2
24
35
#define plugin_ref_to_int(A) (A ? A[0] : NULL)
25
36
#define plugin_int_to_ref(A) &(A)
27
40
extern struct st_mysql_plugin *mysqld_builtins[];
29
42
char *opt_plugin_load= NULL;
42
55
{ C_STRING_WITH_LEN("UDA") },
43
56
{ C_STRING_WITH_LEN("AUDIT") },
44
57
{ C_STRING_WITH_LEN("LOGGER") },
45
{ C_STRING_WITH_LEN("AUTH") }
58
{ C_STRING_WITH_LEN("ERRMSG") },
59
{ C_STRING_WITH_LEN("AUTH") },
60
{ C_STRING_WITH_LEN("CONFIGVAR") },
61
{ C_STRING_WITH_LEN("QCACHE") },
62
{ C_STRING_WITH_LEN("PARSER") },
63
{ C_STRING_WITH_LEN("SCHEDULING") }
48
66
extern int initialize_schema_table(st_plugin_int *plugin);
163
191
sys_var_pluginvar *cast_pluginvar() { return this; }
164
192
bool is_readonly() const { return plugin_var->flags & PLUGIN_VAR_READONLY; }
165
193
bool check_type(enum_var_type type)
166
{ return !(plugin_var->flags & PLUGIN_VAR_THDLOCAL) && type != OPT_GLOBAL; }
194
{ return !(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) && type != OPT_GLOBAL; }
167
195
bool check_update_type(Item_result type);
168
196
SHOW_TYPE show_type();
169
unsigned char* real_value_ptr(THD *thd, enum_var_type type);
197
unsigned char* real_value_ptr(Session *session, enum_var_type type);
170
198
TYPELIB* plugin_var_typelib(void);
171
unsigned char* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
172
bool check(THD *thd, set_var *var);
199
unsigned char* value_ptr(Session *session, enum_var_type type, LEX_STRING *base);
200
bool check(Session *session, set_var *var);
173
201
bool check_default(enum_var_type type __attribute__((unused)))
174
202
{ return is_readonly(); }
175
void set_default(THD *thd,
203
void set_default(Session *session,
176
204
enum_var_type type __attribute__((unused)));
177
bool update(THD *thd, set_var *var);
205
bool update(Session *session, set_var *var);
339
368
memset(&plugin_dl, 0, sizeof(plugin_dl));
340
369
/* Compile dll path */
342
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NULL) -
370
dlpath.append(opt_plugin_dir);
372
dlpath.append(dl->str);
344
373
plugin_dl.ref_count= 1;
345
374
/* Open new dll handle */
346
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_LAZY|RTLD_GLOBAL)))
375
if (!(plugin_dl.handle= dlopen(dlpath.c_str(), RTLD_LAZY|RTLD_GLOBAL)))
348
377
const char *errmsg=dlerror();
349
if (!strncmp(dlpath, errmsg, dlpathlen))
378
uint32_t dlpathlen= dlpath.length();
379
if (!dlpath.compare(0, dlpathlen, errmsg))
350
380
{ // if errmsg starts from dlpath, trim this prefix.
351
381
errmsg+=dlpathlen;
352
382
if (*errmsg == ':') errmsg++;
353
383
if (*errmsg == ' ') errmsg++;
355
385
if (report & REPORT_TO_USER)
356
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, errmsg);
386
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath.c_str(), errno, errmsg);
357
387
if (report & REPORT_TO_LOG)
358
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, errno, errmsg);
388
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath.c_str(), errno, errmsg);
1293
1323
#define EXTRA_OPTIONS 3 /* options for: 'foo', 'plugin-foo' and NULL */
1295
1325
typedef DECLARE_DRIZZLE_SYSVAR_BASIC(sysvar_bool_t, bool);
1296
typedef DECLARE_DRIZZLE_THDVAR_BASIC(thdvar_bool_t, bool);
1326
typedef DECLARE_DRIZZLE_SessionVAR_BASIC(sessionvar_bool_t, bool);
1297
1327
typedef DECLARE_DRIZZLE_SYSVAR_BASIC(sysvar_str_t, char *);
1298
typedef DECLARE_DRIZZLE_THDVAR_BASIC(thdvar_str_t, char *);
1328
typedef DECLARE_DRIZZLE_SessionVAR_BASIC(sessionvar_str_t, char *);
1300
1330
typedef DECLARE_DRIZZLE_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long);
1301
typedef DECLARE_DRIZZLE_THDVAR_TYPELIB(thdvar_enum_t, unsigned long);
1331
typedef DECLARE_DRIZZLE_SessionVAR_TYPELIB(sessionvar_enum_t, unsigned long);
1302
1332
typedef DECLARE_DRIZZLE_SYSVAR_TYPELIB(sysvar_set_t, uint64_t);
1303
typedef DECLARE_DRIZZLE_THDVAR_TYPELIB(thdvar_set_t, uint64_t);
1333
typedef DECLARE_DRIZZLE_SessionVAR_TYPELIB(sessionvar_set_t, uint64_t);
1305
1335
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_int_t, int);
1306
1336
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_long_t, long);
1309
1339
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
1310
1340
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_uint64_t_t, uint64_t);
1312
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_int_t, int);
1313
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_long_t, long);
1314
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_int64_t_t, int64_t);
1315
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_uint_t, uint);
1316
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
1317
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_uint64_t_t, uint64_t);
1342
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_int_t, int);
1343
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_long_t, long);
1344
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_int64_t_t, int64_t);
1345
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_uint_t, uint);
1346
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_ulong_t, ulong);
1347
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_uint64_t_t, uint64_t);
1319
typedef bool *(*mysql_sys_var_ptr_p)(THD* a_thd, int offset);
1349
typedef bool *(*mysql_sys_var_ptr_p)(Session* a_session, int offset);
1322
1352
/****************************************************************************
1323
1353
default variable data check and update functions
1324
1354
****************************************************************************/
1326
static int check_func_bool(THD *thd __attribute__((unused)),
1356
static int check_func_bool(Session *session __attribute__((unused)),
1327
1357
struct st_mysql_sys_var *var,
1328
1358
void *save, st_mysql_value *value)
1769
returns a pointer to the memory which holds the thd-local variable or
1770
a pointer to the global variable if thd==null.
1799
returns a pointer to the memory which holds the session-local variable or
1800
a pointer to the global variable if session==null.
1771
1801
If required, will sync with global variables if the requested variable
1772
1802
has not yet been allocated in the current thread.
1774
static unsigned char *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
1804
static unsigned char *intern_sys_var_ptr(Session* session, int offset, bool global_lock)
1776
1806
assert(offset >= 0);
1777
1807
assert((uint)offset <= global_system_variables.dynamic_variables_head);
1780
1810
return (unsigned char*) global_system_variables.dynamic_variables_ptr + offset;
1783
1813
dynamic_variables_head points to the largest valid offset
1785
if (!thd->variables.dynamic_variables_ptr ||
1786
(uint)offset > thd->variables.dynamic_variables_head)
1815
if (!session->variables.dynamic_variables_ptr ||
1816
(uint)offset > session->variables.dynamic_variables_head)
1790
1820
rw_rdlock(&LOCK_system_variables_hash);
1792
thd->variables.dynamic_variables_ptr= (char*)
1793
my_realloc(thd->variables.dynamic_variables_ptr,
1822
session->variables.dynamic_variables_ptr= (char*)
1823
my_realloc(session->variables.dynamic_variables_ptr,
1794
1824
global_variables_dynamic_size,
1795
1825
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
1838
1868
if (global_lock)
1839
1869
pthread_mutex_unlock(&LOCK_global_system_variables);
1841
thd->variables.dynamic_variables_version=
1871
session->variables.dynamic_variables_version=
1842
1872
global_system_variables.dynamic_variables_version;
1843
thd->variables.dynamic_variables_head=
1873
session->variables.dynamic_variables_head=
1844
1874
global_system_variables.dynamic_variables_head;
1845
thd->variables.dynamic_variables_size=
1875
session->variables.dynamic_variables_size=
1846
1876
global_system_variables.dynamic_variables_size;
1848
1878
rw_unlock(&LOCK_system_variables_hash);
1850
return (unsigned char*)thd->variables.dynamic_variables_ptr + offset;
1853
static bool *mysql_sys_var_ptr_bool(THD* a_thd, int offset)
1855
return (bool *)intern_sys_var_ptr(a_thd, offset, true);
1858
static int *mysql_sys_var_ptr_int(THD* a_thd, int offset)
1860
return (int *)intern_sys_var_ptr(a_thd, offset, true);
1863
static long *mysql_sys_var_ptr_long(THD* a_thd, int offset)
1865
return (long *)intern_sys_var_ptr(a_thd, offset, true);
1868
static int64_t *mysql_sys_var_ptr_int64_t(THD* a_thd, int offset)
1870
return (int64_t *)intern_sys_var_ptr(a_thd, offset, true);
1873
static char **mysql_sys_var_ptr_str(THD* a_thd, int offset)
1875
return (char **)intern_sys_var_ptr(a_thd, offset, true);
1878
static uint64_t *mysql_sys_var_ptr_set(THD* a_thd, int offset)
1880
return (uint64_t *)intern_sys_var_ptr(a_thd, offset, true);
1883
static unsigned long *mysql_sys_var_ptr_enum(THD* a_thd, int offset)
1885
return (unsigned long *)intern_sys_var_ptr(a_thd, offset, true);
1889
void plugin_thdvar_init(THD *thd)
1891
plugin_ref old_table_plugin= thd->variables.table_plugin;
1893
thd->variables.table_plugin= NULL;
1894
cleanup_variables(thd, &thd->variables);
1896
thd->variables= global_system_variables;
1897
thd->variables.table_plugin= NULL;
1880
return (unsigned char*)session->variables.dynamic_variables_ptr + offset;
1883
static bool *mysql_sys_var_ptr_bool(Session* a_session, int offset)
1885
return (bool *)intern_sys_var_ptr(a_session, offset, true);
1888
static int *mysql_sys_var_ptr_int(Session* a_session, int offset)
1890
return (int *)intern_sys_var_ptr(a_session, offset, true);
1893
static long *mysql_sys_var_ptr_long(Session* a_session, int offset)
1895
return (long *)intern_sys_var_ptr(a_session, offset, true);
1898
static int64_t *mysql_sys_var_ptr_int64_t(Session* a_session, int offset)
1900
return (int64_t *)intern_sys_var_ptr(a_session, offset, true);
1903
static char **mysql_sys_var_ptr_str(Session* a_session, int offset)
1905
return (char **)intern_sys_var_ptr(a_session, offset, true);
1908
static uint64_t *mysql_sys_var_ptr_set(Session* a_session, int offset)
1910
return (uint64_t *)intern_sys_var_ptr(a_session, offset, true);
1913
static unsigned long *mysql_sys_var_ptr_enum(Session* a_session, int offset)
1915
return (unsigned long *)intern_sys_var_ptr(a_session, offset, true);
1919
void plugin_sessionvar_init(Session *session)
1921
plugin_ref old_table_plugin= session->variables.table_plugin;
1923
session->variables.table_plugin= NULL;
1924
cleanup_variables(session, &session->variables);
1926
session->variables= global_system_variables;
1927
session->variables.table_plugin= NULL;
1899
1929
/* we are going to allocate these lazily */
1900
thd->variables.dynamic_variables_version= 0;
1901
thd->variables.dynamic_variables_size= 0;
1902
thd->variables.dynamic_variables_ptr= 0;
1930
session->variables.dynamic_variables_version= 0;
1931
session->variables.dynamic_variables_size= 0;
1932
session->variables.dynamic_variables_ptr= 0;
1904
thd->variables.table_plugin=
1934
session->variables.table_plugin=
1905
1935
my_intern_plugin_lock(NULL, global_system_variables.table_plugin);
1906
1936
intern_plugin_unlock(NULL, old_table_plugin);
1967
void plugin_thdvar_cleanup(THD *thd)
1997
void plugin_sessionvar_cleanup(Session *session)
1970
2000
plugin_ref *list;
1972
unlock_variables(thd, &thd->variables);
1973
cleanup_variables(thd, &thd->variables);
2002
unlock_variables(session, &session->variables);
2003
cleanup_variables(session, &session->variables);
1975
if ((idx= thd->lex->plugins.elements))
2005
if ((idx= session->lex->plugins.elements))
1977
list= ((plugin_ref*) thd->lex->plugins.buffer) + idx - 1;
1978
while ((unsigned char*) list >= thd->lex->plugins.buffer)
2007
list= ((plugin_ref*) session->lex->plugins.buffer) + idx - 1;
2008
while ((unsigned char*) list >= session->lex->plugins.buffer)
1979
2009
intern_plugin_unlock(NULL, *list--);
1982
reset_dynamic(&thd->lex->plugins);
2012
reset_dynamic(&session->lex->plugins);
2151
2181
pthread_mutex_lock(&LOCK_global_system_variables);
2152
tgt= real_value_ptr(thd, type);
2182
tgt= real_value_ptr(session, type);
2153
2183
src= ((void **) (plugin_var + 1) + 1);
2155
if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
2185
if (plugin_var->flags & PLUGIN_VAR_SessionLOCAL)
2157
2187
if (type != OPT_GLOBAL)
2158
src= real_value_ptr(thd, OPT_GLOBAL);
2188
src= real_value_ptr(session, OPT_GLOBAL);
2160
2190
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
2161
2191
case PLUGIN_VAR_INT:
2162
src= &((thdvar_uint_t*) plugin_var)->def_val;
2192
src= &((sessionvar_uint_t*) plugin_var)->def_val;
2164
2194
case PLUGIN_VAR_LONG:
2165
src= &((thdvar_ulong_t*) plugin_var)->def_val;
2195
src= &((sessionvar_ulong_t*) plugin_var)->def_val;
2167
2197
case PLUGIN_VAR_LONGLONG:
2168
src= &((thdvar_uint64_t_t*) plugin_var)->def_val;
2198
src= &((sessionvar_uint64_t_t*) plugin_var)->def_val;
2170
2200
case PLUGIN_VAR_ENUM:
2171
src= &((thdvar_enum_t*) plugin_var)->def_val;
2201
src= &((sessionvar_enum_t*) plugin_var)->def_val;
2173
2203
case PLUGIN_VAR_SET:
2174
src= &((thdvar_set_t*) plugin_var)->def_val;
2204
src= &((sessionvar_set_t*) plugin_var)->def_val;
2176
2206
case PLUGIN_VAR_BOOL:
2177
src= &((thdvar_bool_t*) plugin_var)->def_val;
2207
src= &((sessionvar_bool_t*) plugin_var)->def_val;
2179
2209
case PLUGIN_VAR_STR:
2180
src= &((thdvar_str_t*) plugin_var)->def_val;
2210
src= &((sessionvar_str_t*) plugin_var)->def_val;
2187
/* thd must equal current_thd if PLUGIN_VAR_THDLOCAL flag is set */
2188
assert(!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
2189
thd == current_thd);
2217
/* session must equal current_session if PLUGIN_VAR_SessionLOCAL flag is set */
2218
assert(!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) ||
2219
session == current_session);
2191
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL)
2221
if (!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) || type == OPT_GLOBAL)
2193
plugin_var->update(thd, plugin_var, tgt, src);
2223
plugin_var->update(session, plugin_var, tgt, src);
2194
2224
pthread_mutex_unlock(&LOCK_global_system_variables);
2198
2228
pthread_mutex_unlock(&LOCK_global_system_variables);
2199
plugin_var->update(thd, plugin_var, tgt, src);
2229
plugin_var->update(session, plugin_var, tgt, src);
2204
bool sys_var_pluginvar::update(THD *thd, set_var *var)
2234
bool sys_var_pluginvar::update(Session *session, set_var *var)
2208
2238
assert(is_readonly() || plugin_var->update);
2210
/* thd must equal current_thd if PLUGIN_VAR_THDLOCAL flag is set */
2211
assert(!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
2212
thd == current_thd);
2240
/* session must equal current_session if PLUGIN_VAR_SessionLOCAL flag is set */
2241
assert(!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) ||
2242
session == current_session);
2214
2244
if (is_readonly())
2217
2247
pthread_mutex_lock(&LOCK_global_system_variables);
2218
tgt= real_value_ptr(thd, var->type);
2248
tgt= real_value_ptr(session, var->type);
2220
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || var->type == OPT_GLOBAL)
2250
if (!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) || var->type == OPT_GLOBAL)
2222
2252
/* variable we are updating has global scope, so we unlock after updating */
2223
plugin_var->update(thd, plugin_var, tgt, &var->save_result);
2253
plugin_var->update(session, plugin_var, tgt, &var->save_result);
2224
2254
pthread_mutex_unlock(&LOCK_global_system_variables);
2228
2258
pthread_mutex_unlock(&LOCK_global_system_variables);
2229
plugin_var->update(thd, plugin_var, tgt, &var->save_result);
2259
plugin_var->update(session, plugin_var, tgt, &var->save_result);
2290
2320
options->def_value= (intptr_t) ((sysvar_str_t*) opt)->def_val;
2292
2322
/* threadlocal variables */
2293
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
2294
OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt);
2296
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2297
OPTION_SET_LIMITS(GET_UINT, options, (thdvar_uint_t*) opt);
2299
case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL:
2300
OPTION_SET_LIMITS(GET_LONG, options, (thdvar_long_t*) opt);
2302
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2303
OPTION_SET_LIMITS(GET_ULONG, options, (thdvar_ulong_t*) opt);
2305
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
2306
OPTION_SET_LIMITS(GET_LL, options, (thdvar_int64_t_t*) opt);
2308
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2309
OPTION_SET_LIMITS(GET_ULL, options, (thdvar_uint64_t_t*) opt);
2311
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
2323
case PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL:
2324
OPTION_SET_LIMITS(GET_INT, options, (sessionvar_int_t*) opt);
2326
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2327
OPTION_SET_LIMITS(GET_UINT, options, (sessionvar_uint_t*) opt);
2329
case PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL:
2330
OPTION_SET_LIMITS(GET_LONG, options, (sessionvar_long_t*) opt);
2332
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2333
OPTION_SET_LIMITS(GET_ULONG, options, (sessionvar_ulong_t*) opt);
2335
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL:
2336
OPTION_SET_LIMITS(GET_LL, options, (sessionvar_int64_t_t*) opt);
2338
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2339
OPTION_SET_LIMITS(GET_ULL, options, (sessionvar_uint64_t_t*) opt);
2341
case PLUGIN_VAR_ENUM | PLUGIN_VAR_SessionLOCAL:
2312
2342
options->var_type= GET_ENUM;
2313
options->typelib= ((thdvar_enum_t*) opt)->typelib;
2314
options->def_value= ((thdvar_enum_t*) opt)->def_val;
2343
options->typelib= ((sessionvar_enum_t*) opt)->typelib;
2344
options->def_value= ((sessionvar_enum_t*) opt)->def_val;
2315
2345
options->min_value= options->block_size= 0;
2316
2346
options->max_value= options->typelib->count - 1;
2318
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
2348
case PLUGIN_VAR_SET | PLUGIN_VAR_SessionLOCAL:
2319
2349
options->var_type= GET_SET;
2320
options->typelib= ((thdvar_set_t*) opt)->typelib;
2321
options->def_value= ((thdvar_set_t*) opt)->def_val;
2350
options->typelib= ((sessionvar_set_t*) opt)->typelib;
2351
options->def_value= ((sessionvar_set_t*) opt)->def_val;
2322
2352
options->min_value= options->block_size= 0;
2323
2353
options->max_value= (1UL << options->typelib->count) - 1;
2325
case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
2355
case PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL:
2326
2356
options->var_type= GET_BOOL;
2327
options->def_value= ((thdvar_bool_t*) opt)->def_val;
2357
options->def_value= ((sessionvar_bool_t*) opt)->def_val;
2329
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
2359
case PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL:
2330
2360
options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ?
2331
2361
GET_STR_ALLOC : GET_STR);
2332
options->def_value= (intptr_t) ((thdvar_str_t*) opt)->def_val;
2362
options->def_value= (intptr_t) ((sessionvar_str_t*) opt)->def_val;
2404
2434
plugin_option && *plugin_option; plugin_option++, index++)
2406
2436
opt= *plugin_option;
2407
if (!(opt->flags & PLUGIN_VAR_THDLOCAL))
2437
if (!(opt->flags & PLUGIN_VAR_SessionLOCAL))
2409
2439
if (!(register_var(name, opt->name, opt->flags)))
2411
2441
switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
2412
2442
case PLUGIN_VAR_BOOL:
2413
(((thdvar_bool_t *)opt)->resolve)= mysql_sys_var_ptr_bool;
2443
(((sessionvar_bool_t *)opt)->resolve)= mysql_sys_var_ptr_bool;
2415
2445
case PLUGIN_VAR_INT:
2416
(((thdvar_int_t *)opt)->resolve)= mysql_sys_var_ptr_int;
2446
(((sessionvar_int_t *)opt)->resolve)= mysql_sys_var_ptr_int;
2418
2448
case PLUGIN_VAR_LONG:
2419
(((thdvar_long_t *)opt)->resolve)= mysql_sys_var_ptr_long;
2449
(((sessionvar_long_t *)opt)->resolve)= mysql_sys_var_ptr_long;
2421
2451
case PLUGIN_VAR_LONGLONG:
2422
(((thdvar_int64_t_t *)opt)->resolve)= mysql_sys_var_ptr_int64_t;
2452
(((sessionvar_int64_t_t *)opt)->resolve)= mysql_sys_var_ptr_int64_t;
2424
2454
case PLUGIN_VAR_STR:
2425
(((thdvar_str_t *)opt)->resolve)= mysql_sys_var_ptr_str;
2455
(((sessionvar_str_t *)opt)->resolve)= mysql_sys_var_ptr_str;
2427
2457
case PLUGIN_VAR_ENUM:
2428
(((thdvar_enum_t *)opt)->resolve)= mysql_sys_var_ptr_enum;
2458
(((sessionvar_enum_t *)opt)->resolve)= mysql_sys_var_ptr_enum;
2430
2460
case PLUGIN_VAR_SET:
2431
(((thdvar_set_t *)opt)->resolve)= mysql_sys_var_ptr_set;
2461
(((sessionvar_set_t *)opt)->resolve)= mysql_sys_var_ptr_set;
2434
2464
sql_print_error(_("Unknown variable type code 0x%x in plugin '%s'."),