~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_share.h

  • Committer: Brian Aker
  • Date: 2010-05-12 22:54:08 UTC
  • mto: This revision was merged to the branch mainline in revision 1528.
  • Revision ID: brian@gaz-20100512225408-ok21ur8j78ywkb9e
This is:
1) First pass to have Share use something other then mem_root allocated bits.
2) A bug fix on how keys are matched for with USE INDEX, etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
273
273
    return mem_root.strmake_root(str_arg, len_arg);
274
274
  }
275
275
 
 
276
private:
276
277
  TYPELIB keynames;                     /* Pointers to keynames */
 
278
  std::vector<std::string> _keynames;
 
279
 
 
280
  void addKeyName(std::string arg)
 
281
  {
 
282
    std::transform(arg.begin(), arg.end(),
 
283
                   arg.begin(), ::toupper);
 
284
    _keynames.push_back(arg);
 
285
  }
 
286
public:
 
287
  bool doesKeyNameExist(const char *name_arg, uint32_t name_length, uint32_t &position)
 
288
  {
 
289
    std::string arg(name_arg, name_length);
 
290
    std::transform(arg.begin(), arg.end(),
 
291
                   arg.begin(), ::toupper);
 
292
 
 
293
    std::vector<std::string>::iterator iter= std::find(_keynames.begin(), _keynames.end(), arg);
 
294
 
 
295
    if (iter == _keynames.end())
 
296
      return false;
 
297
 
 
298
    position= iter -  _keynames.begin();
 
299
 
 
300
    return true;
 
301
  }
 
302
 
277
303
  TYPELIB fieldnames;                   /* Pointer to fieldnames */
278
304
  TYPELIB *intervals;                   /* pointer to interval info */
279
305
  pthread_mutex_t mutex;                /* For locking the share  */