~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: lbieber at stabletransit
  • Date: 2010-10-19 14:03:27 UTC
  • mfrom: (1861.1.2 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101019140327-2jvt5j2wi4pzhm1z
Merge Brian - Small collection of cleanups/refactor'ing around locks
Merge Monty - fix a few things in the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1776
1776
 
1777
1777
user_var_entry *Session::getVariable(const std::string  &name, bool create_if_not_exists)
1778
1778
{
1779
 
  user_var_entry *entry= NULL;
1780
1779
  UserVarsRange ppp= user_vars.equal_range(name);
1781
1780
 
1782
1781
  for (UserVars::iterator iter= ppp.first;
1783
 
         iter != ppp.second; ++iter)
 
1782
       iter != ppp.second; ++iter)
1784
1783
  {
1785
 
    entry= (*iter).second;
 
1784
    return (*iter).second;
1786
1785
  }
1787
1786
 
1788
 
  if ((entry == NULL) && create_if_not_exists)
 
1787
  if (not create_if_not_exists)
 
1788
    return NULL;
 
1789
 
 
1790
  user_var_entry *entry= NULL;
 
1791
  entry= new (nothrow) user_var_entry(name.c_str(), query_id);
 
1792
 
 
1793
  if (entry == NULL)
 
1794
    return NULL;
 
1795
 
 
1796
  std::pair<UserVars::iterator, bool> returnable= user_vars.insert(make_pair(name, entry));
 
1797
 
 
1798
  if (not returnable.second)
1789
1799
  {
1790
 
    entry= new (nothrow) user_var_entry(name.c_str(), query_id);
1791
 
 
1792
 
    if (entry == NULL)
1793
 
      return NULL;
1794
 
 
1795
 
    std::pair<UserVars::iterator, bool> returnable= user_vars.insert(make_pair(name, entry));
1796
 
 
1797
 
    if (not returnable.second)
1798
 
    {
1799
 
      delete entry;
1800
 
      return NULL;
1801
 
    }
 
1800
    delete entry;
1802
1801
  }
1803
1802
 
1804
1803
  return entry;