~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_plugin.cc

  • Committer: Mark Atwood
  • Date: 2008-07-12 07:25:25 UTC
  • mto: This revision was merged to the branch mainline in revision 139.
  • Revision ID: me@mark.atwood.name-20080712072525-s1dq9mtwo5td7af7
more hackery to get plugin UDFs working

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
extern int initialize_schema_table(st_plugin_int *plugin);
45
45
extern int finalize_schema_table(st_plugin_int *plugin);
46
46
 
 
47
extern int initialize_udf(st_plugin_int *plugin);
 
48
extern int finalize_udf(st_plugin_int *plugin);
 
49
 
47
50
/*
48
51
  The number of elements in both plugin_type_initialize and
49
52
  plugin_type_deinitialize should equal to the number of plugins
51
54
*/
52
55
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
53
56
{
54
 
  0,ha_initialize_handlerton,0,0,initialize_schema_table,
 
57
  initialize_udf,ha_initialize_handlerton,0,0,initialize_schema_table,
55
58
  0
56
59
};
57
60
 
58
61
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
59
62
{
60
 
  0,ha_finalize_handlerton,0,0,finalize_schema_table,
 
63
  finalize_udf,ha_finalize_handlerton,0,0,finalize_schema_table,
61
64
  0
62
65
};
63
66
 
64
 
#ifdef HAVE_DLOPEN
65
67
static const char *plugin_interface_version_sym=
66
68
                   "_mysql_plugin_interface_version_";
67
69
static const char *sizeof_st_plugin_sym=
68
70
                   "_mysql_sizeof_struct_st_plugin_";
69
71
static const char *plugin_declarations_sym= "_mysql_plugin_declarations_";
70
72
static int min_plugin_interface_version= MYSQL_PLUGIN_INTERFACE_VERSION & ~0xFF;
71
 
#endif
72
73
 
73
74
/* Note that 'int version' must be the first field of every plugin
74
75
   sub-structure (plugin->info).
75
76
*/
76
77
static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
77
78
{
78
 
  0x0000,
 
79
  MYSQL_UDF_INTERFACE_VERSION,
79
80
  MYSQL_HANDLERTON_INTERFACE_VERSION,
80
81
  MYSQL_FTPARSER_INTERFACE_VERSION,
81
82
  MYSQL_DAEMON_INTERFACE_VERSION,
84
85
};
85
86
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
86
87
{
87
 
  0x0000, /* UDF: not implemented */
 
88
  MYSQL_UDF_INTERFACE_VERSION,
88
89
  MYSQL_HANDLERTON_INTERFACE_VERSION,
89
90
  MYSQL_FTPARSER_INTERFACE_VERSION,
90
91
  MYSQL_DAEMON_INTERFACE_VERSION,
267
268
  Plugin support code
268
269
****************************************************************************/
269
270
 
270
 
#ifdef HAVE_DLOPEN
271
 
 
272
271
static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl)
273
272
{
274
273
  uint i;
285
284
  return(0);
286
285
}
287
286
 
288
 
 
289
287
static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl)
290
288
{
291
289
  uint i;
307
305
                                           sizeof(struct st_plugin_dl));
308
306
  return(tmp);
309
307
}
310
 
#endif /* HAVE_DLOPEN */
311
 
 
312
308
 
313
309
static inline void free_plugin_mem(struct st_plugin_dl *p)
314
310
{
315
 
#ifdef HAVE_DLOPEN
316
311
  if (p->handle)
317
312
    dlclose(p->handle);
318
 
#endif
319
313
  my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR));
320
314
  if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION)
321
315
    my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR));