~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/user_locks/get_lock.cc

  • Committer: Lee Bieber
  • Date: 2010-12-13 18:43:55 UTC
  • mfrom: (1993.3.2 trunk-bug-686773)
  • mto: This revision was merged to the branch mainline in revision 1994.
  • Revision ID: kalebral@gmail.com-20101213184355-tinkj77bvfwwy6ql
Merge Andrew - fix bug 686773: TableFunction::Generator::push() needs assert

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
  }
44
44
  null_value= false;
45
45
 
 
46
  std::cerr << "Trying to create " << res->c_str() << "\n";
 
47
 
46
48
  user_locks::Storable *list= static_cast<user_locks::Storable *>(getSession().getProperty("user_locks"));
47
49
  if (list) // To be compatible with MySQL, we will now release all other locks we might have.
48
50
    list->erase_all();
49
51
 
50
52
  bool result;
51
 
  drizzled::identifier::User::const_shared_ptr user_identifier(getSession().user());
52
53
  {
53
54
    boost::this_thread::restore_interruption dl(getSession().getThreadInterupt());
54
55
 
55
56
    try {
56
 
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), Key(*user_identifier, res->c_str()), wait_time);
 
57
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), Key(getSession().getSecurityContext(), res->c_str()), wait_time);
57
58
    }
58
59
    catch(boost::thread_interrupted const& error)
59
60
    {
64
65
    }
65
66
  }
66
67
 
 
68
  if (boost::indeterminate(result))
 
69
    null_value= true;
 
70
 
67
71
  if (result)
68
72
  {
69
73
    if (not list)
72
76
      getSession().setProperty("user_locks", list);
73
77
    }
74
78
 
75
 
    list->insert(Key(*user_identifier, res->c_str()));
 
79
    list->insert(Key(getSession().getSecurityContext(), res->c_str()));
76
80
 
77
81
    return 1;
78
82
  }