~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/loader.cc

  • Committer: Monty Taylor
  • Date: 2010-08-20 19:08:50 UTC
  • mto: (1728.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1729.
  • Revision ID: mordred@inaugust.com-20100820190850-nfycirpyrcpst07a
Renamed st_bookmark. Removed name_len.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
  Item *item;
106
106
};
107
107
 
108
 
struct st_bookmark
 
108
class Bookmark
109
109
{
110
 
  uint32_t name_len;
 
110
public:
 
111
  Bookmark() :
 
112
    type_code(0),
 
113
    offset(0),
 
114
    version(0),
 
115
    key("")
 
116
  {}
111
117
  uint8_t type_code;
112
118
  int offset;
113
119
  uint32_t version;
114
120
  string key;
115
121
};
116
 
typedef boost::unordered_map<string, st_bookmark> bookmark_unordered_map;
 
122
 
 
123
typedef boost::unordered_map<string, Bookmark> bookmark_unordered_map;
117
124
static bookmark_unordered_map bookmark_hash;
118
125
 
119
126
 
796
803
  Returns the 'bookmark' for the named variable.
797
804
  LOCK_system_variables_hash should be at least read locked
798
805
*/
799
 
static st_bookmark *find_bookmark(const string &plugin, const char *name, int flags)
 
806
static Bookmark *find_bookmark(const string &plugin, const char *name, int flags)
800
807
{
801
808
  if (!(flags & PLUGIN_VAR_SessionLOCAL))
802
809
    return NULL;
817
824
  returns null for non session-local variables.
818
825
  Requires that a write lock is obtained on LOCK_system_variables_hash
819
826
*/
820
 
static st_bookmark *register_var(const string &plugin, const char *name,
 
827
static Bookmark *register_var(const string &plugin, const char *name,
821
828
                                 int flags)
822
829
{
823
830
  if (!(flags & PLUGIN_VAR_SessionLOCAL))
824
831
    return NULL;
825
832
 
826
833
  uint32_t size= 0, offset, new_size;
827
 
  st_bookmark *result= NULL;
 
834
  Bookmark *result= NULL;
828
835
 
829
836
  switch (flags & PLUGIN_VAR_TYPEMASK) {
830
837
  case PLUGIN_VAR_BOOL:
852
859
  {
853
860
    const string varname(make_bookmark_name(plugin, name));
854
861
 
855
 
    st_bookmark new_bookmark;
 
862
    Bookmark new_bookmark;
856
863
    new_bookmark.key= varname;
857
 
    new_bookmark.name_len= varname.size() - 1;
858
864
    new_bookmark.offset= -1;
859
865
 
860
866
    assert(size && !(size & (size-1))); /* must be power of 2 */
959
965
    {
960
966
      sys_var_pluginvar *pi;
961
967
      sys_var *var;
962
 
      const st_bookmark &v= (*iter).second;
 
968
      const Bookmark &v= (*iter).second;
963
969
      const string var_name((*iter).first);
964
970
 
965
971
      if (v.version <= session->variables.dynamic_variables_version ||
1062
1068
  bookmark_unordered_map::iterator iter= bookmark_hash.begin();
1063
1069
  for (; iter != bookmark_hash.end() ; ++iter)
1064
1070
  {
1065
 
    const st_bookmark &v= (*iter).second;
 
1071
    const Bookmark &v= (*iter).second;
1066
1072
    const string key_name((*iter).first);
1067
1073
    if (v.version > vars->dynamic_variables_version ||
1068
1074
        !(var= intern_find_sys_var(key_name.c_str(), key_name.size(), true)) ||
1404
1410
  char *optname, *p;
1405
1411
  int index= 0, offset= 0;
1406
1412
  drizzle_sys_var *opt, **plugin_option;
1407
 
  st_bookmark *v;
 
1413
  Bookmark *v;
1408
1414
 
1409
1415
  string name(plugin_name);
1410
1416
  transform(name.begin(), name.end(), name.begin(), ::tolower);
1534
1540
      if (opt->flags & PLUGIN_VAR_NOCMDOPT)
1535
1541
        continue;
1536
1542
 
1537
 
      optname= (char*) mem_root->memdup_root(v->key.c_str(), (optnamelen= v->name_len) + 1);
 
1543
      optname= (char*) mem_root->memdup_root(v->key.c_str(), (optnamelen= v->key.size()) + 1);
1538
1544
    }
1539
1545
 
1540
1546
    /* convert '_' to '-' */
1621
1627
  option *opts= NULL;
1622
1628
  int error;
1623
1629
  drizzle_sys_var *o;
1624
 
  struct st_bookmark *var;
 
1630
  Bookmark *var;
1625
1631
  uint32_t len, count= EXTRA_OPTIONS;
1626
1632
 
1627
1633
  if (test_module->getManifest().init_options != NULL)