~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/user_locks/get_locks.cc

  • Committer: Brian Aker
  • Date: 2010-10-28 01:45:34 UTC
  • mfrom: (1878.5.8 catalogs)
  • Revision ID: brian@tangent.org-20101028014534-b6qp4wp6crj60h7k
Merge in catalog tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
22
 
#include <plugin/user_locks/module.h>
23
 
#include <plugin/user_locks/lock_storage.h>
 
21
#include "config.h"
 
22
#include "plugin/user_locks/module.h"
 
23
#include "plugin/user_locks/lock_storage.h"
24
24
 
25
25
#include <string>
26
26
 
36
36
 
37
37
    if (res && res->length())
38
38
    {
39
 
      list_of_locks.insert(Key(*getSession().user(), res->c_str()));
 
39
      list_of_locks.insert(Key(getSession().getSecurityContext(), res->c_str()));
40
40
    }
41
41
    else
42
42
    {
43
 
      my_error(drizzled::ER_USER_LOCKS_INVALID_NAME_LOCK, MYF(0));
44
 
      return 0;
45
 
    }
46
 
  }
47
 
 
48
 
  bool result;
49
 
  {
50
 
    boost::this_thread::restore_interruption dl(getSession().getThreadInterupt());
51
 
 
52
 
    try {
53
 
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), list_of_locks);
54
 
    }
55
 
    catch(boost::thread_interrupted const& error)
56
 
    {
57
 
      my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
58
43
      null_value= true;
59
 
 
60
44
      return 0;
61
45
    }
62
46
  }
63
47
 
 
48
  null_value= false;
 
49
 
 
50
 
 
51
  boost::tribool result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), list_of_locks);
 
52
 
 
53
  if (boost::indeterminate(result))
 
54
    null_value= true;
 
55
 
64
56
  if (result)
65
57
  {
66
58
    user_locks::Storable *list= static_cast<user_locks::Storable *>(getSession().getProperty("user_locks"));
76
68
      list->insert(*iter);
77
69
    }
78
70
 
79
 
    null_value= false;
80
 
 
81
71
    return 1;
82
72
  }
83
73