~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/user_locks/get_locks.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
      return 0;
45
45
    }
46
46
  }
47
 
 
48
 
  bool result;
49
47
  {
50
48
    boost::this_thread::restore_interruption dl(getSession().getThreadInterupt());
51
 
 
52
 
    try {
53
 
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), list_of_locks);
 
49
    try 
 
50
    {
 
51
      if (not user_locks::Locks::getInstance().lock(getSession().getSessionId(), list_of_locks))
 
52
        return 0;
54
53
    }
55
 
    catch(boost::thread_interrupted const& error)
 
54
    catch (boost::thread_interrupted const&)
56
55
    {
57
56
      my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
58
57
      null_value= true;
59
 
 
60
58
      return 0;
61
59
    }
62
60
  }
63
61
 
64
 
  if (result)
65
 
  {
66
 
    user_locks::Storable *list= static_cast<user_locks::Storable *>(getSession().getProperty("user_locks"));
67
 
    if (not list)
68
 
    {
69
 
      list= new user_locks::Storable(getSession().getSessionId());
70
 
      getSession().setProperty("user_locks", list);
71
 
    }
72
 
 
73
 
    for (Keys::iterator iter= list_of_locks.begin();
74
 
         iter != list_of_locks.end(); iter++)
75
 
    {
76
 
      list->insert(*iter);
77
 
    }
78
 
 
79
 
    null_value= false;
80
 
 
81
 
    return 1;
82
 
  }
83
 
 
84
 
  return 0;
 
62
  user_locks::Storable *list= getSession().getProperty<user_locks::Storable>("user_locks");
 
63
  if (not list)
 
64
    list= getSession().setProperty("user_locks", new user_locks::Storable(getSession().getSessionId()));
 
65
  BOOST_FOREACH(Keys::const_reference iter, list_of_locks)
 
66
    list->insert(iter);
 
67
  null_value= false;
 
68
  return 1;
85
69
}
86
70
 
87
71
} /* namespace user_locks */